Mercurial > jwe > octave
view libinterp/corefcn/oct-errno.in.cc @ 30351:91c6288781ba
maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
* __isprimelarge__.cc, bsxfun.cc, cellfun.cc, chol.cc, data.cc, error.h,
event-manager.h, filter.cc, find.cc, gcd.cc, gl-render.h, gl2ps-print.cc,
graphics.cc, graphics.in.h, hash.cc, help.cc, hex2num.cc, input.cc, inv.cc,
load-path.cc, load-save.cc, ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, lu.cc,
mappers.cc, matrix_type.cc, max.cc, mex.cc, mxarray.h, oct-errno.in.cc,
oct-map.cc, oct-stream.cc, oct-stream.h, pr-output.cc, psi.cc, qr.cc, rand.cc,
regexp.cc, sparse-xdiv.h, stack-frame.cc, strfind.cc, strfns.cc, sylvester.cc,
symbfact.cc, symrec.h, symscope.cc, typecast.cc, utils.cc, variables.h, xdiv.h,
xpow.h, __init_fltk__.cc, __ode15__.cc, audiodevinfo.cc, audioread.cc,
convhulln.cc, cdef-class.cc, cdef-class.h, cdef-manager.cc, cdef-method.cc,
cdef-object.cc, cdef-object.h, cdef-package.h, cdef-utils.cc, ov-base-diag.cc,
ov-base-int.cc, ov-base.h, ov-bool-mat.cc, ov-bool.cc, ov-cell.cc,
ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-colon.h,
ov-complex.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-dld-fcn.h, ov-fcn-handle.cc,
ov-float.cc, ov-flt-complex.cc, ov-flt-cx-diag.cc, ov-flt-cx-mat.cc,
ov-flt-re-diag.cc, ov-flt-re-mat.cc, ov-java.cc, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-range.cc, ov-re-mat.cc, ov-re-mat.h, ov-re-sparse.cc, ov-scalar.cc,
ov-str-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov.cc, ov.h, octave.h,
bp-table.cc, bp-table.h, lex.h, oct-lvalue.h, profiler.cc, profiler.h,
pt-binop.h, pt-colon.cc, pt-eval.cc, pt-exp.h, pt-select.h:
Shorten some long lines in libinterp to <= 80 characters.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 24 Nov 2021 09:38:51 -0800 |
parents | b7727b8533d8 |
children | 83f9f8bda883 |
line wrap: on
line source
// %NO_EDIT_WARNING% //////////////////////////////////////////////////////////////////////// // // Copyright (C) 2005-2021 The Octave Project Developers // // See the file COPYRIGHT.md in the top-level directory of this // distribution or <https://octave.org/copyright/>. // // This file is part of Octave. // // Octave is free software: you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Octave is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Octave; see the file COPYING. If not, see // <https://www.gnu.org/licenses/>. // //////////////////////////////////////////////////////////////////////// #if defined (HAVE_CONFIG_H) # include "config.h" #endif #include <cerrno> #include "singleton-cleanup.h" #include "oct-errno.h" #include "oct-map.h" #include "error.h" octave_errno *octave_errno::s_instance = nullptr; octave_errno::octave_errno (void) { struct errno_struct { const char *name; int value; }; static errno_struct errno_codes[] = { // POSIX. #if defined (E2BIG) { "E2BIG", E2BIG }, #endif #if defined (EACCES) { "EACCES", EACCES }, #endif #if defined (EADDRINUSE) { "EADDRINUSE", EADDRINUSE }, #endif #if defined (EADDRNOTAVAIL) { "EADDRNOTAVAIL", EADDRNOTAVAIL }, #endif #if defined (EAFNOSUPPORT) { "EAFNOSUPPORT", EAFNOSUPPORT }, #endif #if defined (EAGAIN) { "EAGAIN", EAGAIN }, #endif #if defined (EALREADY) { "EALREADY", EALREADY }, #endif #if defined (EBADF) { "EBADF", EBADF }, #endif #if defined (EBUSY) { "EBUSY", EBUSY }, #endif #if defined (ECHILD) { "ECHILD", ECHILD }, #endif #if defined (ECONNABORTED) { "ECONNABORTED", ECONNABORTED }, #endif #if defined (ECONNREFUSED) { "ECONNREFUSED", ECONNREFUSED }, #endif #if defined (ECONNRESET) { "ECONNRESET", ECONNRESET }, #endif #if defined (EDEADLK) { "EDEADLK", EDEADLK }, #endif #if defined (EDESTADDRREQ) { "EDESTADDRREQ", EDESTADDRREQ }, #endif #if defined (EDOM) { "EDOM", EDOM }, #endif #if defined (EDQUOT) { "EDQUOT", EDQUOT }, #endif #if defined (EEXIST) { "EEXIST", EEXIST }, #endif #if defined (EFAULT) { "EFAULT", EFAULT }, #endif #if defined (EFBIG) { "EFBIG", EFBIG }, #endif #if defined (EHOSTDOWN) { "EHOSTDOWN", EHOSTDOWN }, #endif #if defined (EHOSTUNREACH) { "EHOSTUNREACH", EHOSTUNREACH }, #endif #if defined (EINPROGRESS) { "EINPROGRESS", EINPROGRESS }, #endif #if defined (EINTR) { "EINTR", EINTR }, #endif #if defined (EINVAL) { "EINVAL", EINVAL }, #endif #if defined (EIO) { "EIO", EIO }, #endif #if defined (EISCONN) { "EISCONN", EISCONN }, #endif #if defined (EISDIR) { "EISDIR", EISDIR }, #endif #if defined (ELOOP) { "ELOOP", ELOOP }, #endif #if defined (EMFILE) { "EMFILE", EMFILE }, #endif #if defined (EMLINK) { "EMLINK", EMLINK }, #endif #if defined (EMSGSIZE) { "EMSGSIZE", EMSGSIZE }, #endif #if defined (ENAMETOOLONG) { "ENAMETOOLONG", ENAMETOOLONG }, #endif #if defined (ENETDOWN) { "ENETDOWN", ENETDOWN }, #endif #if defined (ENETRESET) { "ENETRESET", ENETRESET }, #endif #if defined (ENETUNREACH) { "ENETUNREACH", ENETUNREACH }, #endif #if defined (ENFILE) { "ENFILE", ENFILE }, #endif #if defined (ENOBUFS) { "ENOBUFS", ENOBUFS }, #endif #if defined (ENODEV) { "ENODEV", ENODEV }, #endif #if defined (ENOENT) { "ENOENT", ENOENT }, #endif #if defined (ENOEXEC) { "ENOEXEC", ENOEXEC }, #endif #if defined (ENOLCK) { "ENOLCK", ENOLCK }, #endif #if defined (ENOMEM) { "ENOMEM", ENOMEM }, #endif #if defined (ENOPROTOOPT) { "ENOPROTOOPT", ENOPROTOOPT }, #endif #if defined (ENOSPC) { "ENOSPC", ENOSPC }, #endif #if defined (ENOSYS) { "ENOSYS", ENOSYS }, #endif #if defined (ENOTBLK) { "ENOTBLK", ENOTBLK }, #endif #if defined (ENOTCONN) { "ENOTCONN", ENOTCONN }, #endif #if defined (ENOTDIR) { "ENOTDIR", ENOTDIR }, #endif #if defined (ENOTEMPTY) { "ENOTEMPTY", ENOTEMPTY }, #endif #if defined (ENOTSOCK) { "ENOTSOCK", ENOTSOCK }, #endif #if defined (ENOTTY) { "ENOTTY", ENOTTY }, #endif #if defined (ENXIO) { "ENXIO", ENXIO }, #endif #if defined (EOPNOTSUPP) { "EOPNOTSUPP", EOPNOTSUPP }, #endif #if defined (EPERM) { "EPERM", EPERM }, #endif #if defined (EPFNOSUPPORT) { "EPFNOSUPPORT", EPFNOSUPPORT }, #endif #if defined (EPIPE) { "EPIPE", EPIPE }, #endif #if defined (EPROTONOSUPPORT) { "EPROTONOSUPPORT", EPROTONOSUPPORT }, #endif #if defined (EPROTOTYPE) { "EPROTOTYPE", EPROTOTYPE }, #endif #if defined (ERANGE) { "ERANGE", ERANGE }, #endif #if defined (EREMOTE) { "EREMOTE", EREMOTE }, #endif #if defined (ERESTART) { "ERESTART", ERESTART }, #endif #if defined (EROFS) { "EROFS", EROFS }, #endif #if defined (ESHUTDOWN) { "ESHUTDOWN", ESHUTDOWN }, #endif #if defined (ESOCKTNOSUPPORT) { "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT }, #endif #if defined (ESPIPE) { "ESPIPE", ESPIPE }, #endif #if defined (ESRCH) { "ESRCH", ESRCH }, #endif #if defined (ESTALE) { "ESTALE", ESTALE }, #endif #if defined (ETIMEDOUT) { "ETIMEDOUT", ETIMEDOUT }, #endif #if defined (ETOOMANYREFS) { "ETOOMANYREFS", ETOOMANYREFS }, #endif #if defined (ETXTBSY) { "ETXTBSY", ETXTBSY }, #endif #if defined (EUSERS) { "EUSERS", EUSERS }, #endif #if defined (EWOULDBLOCK) { "EWOULDBLOCK", EWOULDBLOCK }, #endif #if defined (EXDEV) { "EXDEV", EXDEV }, #endif // Others (duplicates are OK). @SYSDEP_ERRNO_LIST@ { nullptr, 0 }, }; // Stuff them all in a map for fast access. errno_struct *ptr = errno_codes; while (ptr->name) { m_errno_tbl[ptr->name] = ptr->value; ptr++; } } bool octave_errno::instance_ok (void) { bool retval = true; if (! s_instance) { s_instance = new octave_errno (); singleton_cleanup_list::add (cleanup_instance); } return retval; } int octave_errno::lookup (const std::string& name) { return (instance_ok ()) ? s_instance->do_lookup (name) : -1; } octave_scalar_map octave_errno::list (void) { return (instance_ok ()) ? s_instance->do_list () : octave_scalar_map (); } int octave_errno::do_lookup (const std::string& name) { return (m_errno_tbl.find (name) != m_errno_tbl.end ()) ? m_errno_tbl[name] : -1; } octave_scalar_map octave_errno::do_list (void) { octave_scalar_map retval; for (const auto& p : m_errno_tbl) { retval.assign (p.first, p.second); } return retval; }