File indexing completed on 2024-05-12 15:26:58
0001 /*************************************************************************** 0002 File : errors.h 0003 Project : LabPlot 0004 Description : Translatable strings for GSL error codes 0005 -------------------------------------------------------------------- 0006 Copyright : (C) 2017 Alexander Semke (alexander.semke@web.de) 0007 0008 ***************************************************************************/ 0009 0010 /*************************************************************************** 0011 * * 0012 * This program is free software; you can redistribute it and/or modify * 0013 * it under the terms of the GNU General Public License as published by * 0014 * the Free Software Foundation; either version 2 of the License, or * 0015 * (at your option) any later version. * 0016 * * 0017 * This program is distributed in the hope that it will be useful, * 0018 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0020 * GNU General Public License for more details. * 0021 * * 0022 * You should have received a copy of the GNU General Public License * 0023 * along with this program; if not, write to the Free Software * 0024 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0025 * Boston, MA 02110-1301 USA * 0026 * * 0027 ***************************************************************************/ 0028 0029 #ifndef GSL_ERRORS_H 0030 #define GSL_ERRORS_H 0031 0032 #include <gsl/gsl_errno.h> 0033 #include <KLocalizedString> 0034 0035 namespace { 0036 QString gslErrorToString(int status) { 0037 switch (status) { 0038 case GSL_SUCCESS: 0039 return i18n("Success"); 0040 case GSL_FAILURE: 0041 return i18n("Failure"); 0042 case GSL_CONTINUE: 0043 return i18n("Iteration has not converged"); 0044 case GSL_EDOM: 0045 return i18n("Input domain error, e.g sqrt(-1)"); 0046 case GSL_ERANGE: 0047 return i18n("Output range error, e.g. exp(1e100)"); 0048 case GSL_EFAULT: 0049 return i18n("Invalid pointer"); 0050 case GSL_EINVAL: 0051 return i18n("Invalid argument supplied"); 0052 case GSL_EFAILED: 0053 return i18n("Generic failure"); 0054 case GSL_EFACTOR: 0055 return i18n("Factorization failed"); 0056 case GSL_ENOMEM: 0057 return i18n("Failed to allocate memory"); 0058 case GSL_EBADFUNC: 0059 return i18n("Problem with supplied function"); 0060 case GSL_ERUNAWAY: 0061 return i18n("Iterative process is out of control"); 0062 case GSL_EMAXITER: 0063 return i18n("Exceeded max number of iterations"); 0064 case GSL_EZERODIV: 0065 return i18n("Tried to divide by zero"); 0066 case GSL_EBADTOL: 0067 return i18n("Invalid tolerance specified"); 0068 case GSL_ETOL: 0069 return i18n("Failed to reach the specified tolerance"); 0070 case GSL_EUNDRFLW: 0071 return i18n("Underflow"); 0072 case GSL_EOVRFLW: 0073 return i18n("Overflow"); 0074 case GSL_ELOSS: 0075 return i18n("Loss of accuracy"); 0076 case GSL_EROUND: 0077 return i18n("Failed because of roundoff error"); 0078 case GSL_EBADLEN: 0079 return i18n("Matrix, vector lengths are not conformant"); 0080 case GSL_ENOTSQR: 0081 return i18n("Matrix not square"); 0082 case GSL_ESING: 0083 return i18n("Apparent singularity detected"); 0084 case GSL_EDIVERGE: 0085 return i18n("Integral or series is divergent"); 0086 case GSL_EUNSUP: 0087 return i18n("Requested feature is not supported by the hardware"); 0088 case GSL_EUNIMPL: 0089 return i18n("Requested feature not (yet) implemented"); 0090 case GSL_ECACHE: 0091 return i18n("Cache limit exceeded"); 0092 case GSL_ETABLE: 0093 return i18n("Table limit exceeded"); 0094 case GSL_ENOPROG: 0095 return i18n("Iteration is not making progress towards solution"); 0096 case GSL_ENOPROGJ: 0097 return i18n("Jacobian evaluations are not improving the solution"); 0098 case GSL_ETOLF: 0099 return i18n("Cannot reach the specified tolerance in F"); 0100 case GSL_ETOLX: 0101 return i18n("Cannot reach the specified tolerance in X"); 0102 case GSL_ETOLG: 0103 return i18n("Cannot reach the specified tolerance in gradient"); 0104 case GSL_EOF: 0105 return i18n("End of file"); 0106 default: 0107 return QString(gsl_strerror(status)); 0108 } 0109 } 0110 } 0111 #endif