GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
oct-errno.cc
Go to the documentation of this file.
1 // DO NOT EDIT! Generated automatically from oct-errno.in.cc by configure
2 /*
3 
4 Copyright (C) 2005-2013 John W. Eaton
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 #include <cerrno>
29 
30 #include "singleton-cleanup.h"
31 
32 #include "oct-errno.h"
33 #include "oct-map.h"
34 #include "error.h"
35 
37 
39 {
40  struct errno_struct
41  {
42  const char *name;
43  int value;
44  };
45 
46  static errno_struct errno_codes[] =
47  {
48  // POSIX.
49 
50 #if defined (E2BIG)
51  { "E2BIG", E2BIG, },
52 #endif
53 #if defined (EACCES)
54  { "EACCES", EACCES, },
55 #endif
56 #if defined (EADDRINUSE)
57  { "EADDRINUSE", EADDRINUSE, },
58 #endif
59 #if defined (EADDRNOTAVAIL)
60  { "EADDRNOTAVAIL", EADDRNOTAVAIL, },
61 #endif
62 #if defined (EAFNOSUPPORT)
63  { "EAFNOSUPPORT", EAFNOSUPPORT, },
64 #endif
65 #if defined (EAGAIN)
66  { "EAGAIN", EAGAIN, },
67 #endif
68 #if defined (EALREADY)
69  { "EALREADY", EALREADY, },
70 #endif
71 #if defined (EBADF)
72  { "EBADF", EBADF, },
73 #endif
74 #if defined (EBUSY)
75  { "EBUSY", EBUSY, },
76 #endif
77 #if defined (ECHILD)
78  { "ECHILD", ECHILD, },
79 #endif
80 #if defined (ECONNABORTED)
81  { "ECONNABORTED", ECONNABORTED, },
82 #endif
83 #if defined (ECONNREFUSED)
84  { "ECONNREFUSED", ECONNREFUSED, },
85 #endif
86 #if defined (ECONNRESET)
87  { "ECONNRESET", ECONNRESET, },
88 #endif
89 #if defined (EDEADLK)
90  { "EDEADLK", EDEADLK, },
91 #endif
92 #if defined (EDESTADDRREQ)
93  { "EDESTADDRREQ", EDESTADDRREQ, },
94 #endif
95 #if defined (EDOM)
96  { "EDOM", EDOM, },
97 #endif
98 #if defined (EDQUOT)
99  { "EDQUOT", EDQUOT, },
100 #endif
101 #if defined (EEXIST)
102  { "EEXIST", EEXIST, },
103 #endif
104 #if defined (EFAULT)
105  { "EFAULT", EFAULT, },
106 #endif
107 #if defined (EFBIG)
108  { "EFBIG", EFBIG, },
109 #endif
110 #if defined (EHOSTDOWN)
111  { "EHOSTDOWN", EHOSTDOWN, },
112 #endif
113 #if defined (EHOSTUNREACH)
114  { "EHOSTUNREACH", EHOSTUNREACH, },
115 #endif
116 #if defined (EINPROGRESS)
117  { "EINPROGRESS", EINPROGRESS, },
118 #endif
119 #if defined (EINTR)
120  { "EINTR", EINTR, },
121 #endif
122 #if defined (EINVAL)
123  { "EINVAL", EINVAL, },
124 #endif
125 #if defined (EIO)
126  { "EIO", EIO, },
127 #endif
128 #if defined (EISCONN)
129  { "EISCONN", EISCONN, },
130 #endif
131 #if defined (EISDIR)
132  { "EISDIR", EISDIR, },
133 #endif
134 #if defined (ELOOP)
135  { "ELOOP", ELOOP, },
136 #endif
137 #if defined (EMFILE)
138  { "EMFILE", EMFILE, },
139 #endif
140 #if defined (EMLINK)
141  { "EMLINK", EMLINK, },
142 #endif
143 #if defined (EMSGSIZE)
144  { "EMSGSIZE", EMSGSIZE, },
145 #endif
146 #if defined (ENAMETOOLONG)
147  { "ENAMETOOLONG", ENAMETOOLONG, },
148 #endif
149 #if defined (ENETDOWN)
150  { "ENETDOWN", ENETDOWN, },
151 #endif
152 #if defined (ENETRESET)
153  { "ENETRESET", ENETRESET, },
154 #endif
155 #if defined (ENETUNREACH)
156  { "ENETUNREACH", ENETUNREACH, },
157 #endif
158 #if defined (ENFILE)
159  { "ENFILE", ENFILE, },
160 #endif
161 #if defined (ENOBUFS)
162  { "ENOBUFS", ENOBUFS, },
163 #endif
164 #if defined (ENODEV)
165  { "ENODEV", ENODEV, },
166 #endif
167 #if defined (ENOENT)
168  { "ENOENT", ENOENT, },
169 #endif
170 #if defined (ENOEXEC)
171  { "ENOEXEC", ENOEXEC, },
172 #endif
173 #if defined (ENOLCK)
174  { "ENOLCK", ENOLCK, },
175 #endif
176 #if defined (ENOMEM)
177  { "ENOMEM", ENOMEM, },
178 #endif
179 #if defined (ENOPROTOOPT)
180  { "ENOPROTOOPT", ENOPROTOOPT, },
181 #endif
182 #if defined (ENOSPC)
183  { "ENOSPC", ENOSPC, },
184 #endif
185 #if defined (ENOSYS)
186  { "ENOSYS", ENOSYS, },
187 #endif
188 #if defined (ENOTBLK)
189  { "ENOTBLK", ENOTBLK, },
190 #endif
191 #if defined (ENOTCONN)
192  { "ENOTCONN", ENOTCONN, },
193 #endif
194 #if defined (ENOTDIR)
195  { "ENOTDIR", ENOTDIR, },
196 #endif
197 #if defined (ENOTEMPTY)
198  { "ENOTEMPTY", ENOTEMPTY, },
199 #endif
200 #if defined (ENOTSOCK)
201  { "ENOTSOCK", ENOTSOCK, },
202 #endif
203 #if defined (ENOTTY)
204  { "ENOTTY", ENOTTY, },
205 #endif
206 #if defined (ENXIO)
207  { "ENXIO", ENXIO, },
208 #endif
209 #if defined (EOPNOTSUPP)
210  { "EOPNOTSUPP", EOPNOTSUPP, },
211 #endif
212 #if defined (EPERM)
213  { "EPERM", EPERM, },
214 #endif
215 #if defined (EPFNOSUPPORT)
216  { "EPFNOSUPPORT", EPFNOSUPPORT, },
217 #endif
218 #if defined (EPIPE)
219  { "EPIPE", EPIPE, },
220 #endif
221 #if defined (EPROTONOSUPPORT)
222  { "EPROTONOSUPPORT", EPROTONOSUPPORT, },
223 #endif
224 #if defined (EPROTOTYPE)
225  { "EPROTOTYPE", EPROTOTYPE, },
226 #endif
227 #if defined (ERANGE)
228  { "ERANGE", ERANGE, },
229 #endif
230 #if defined (EREMOTE)
231  { "EREMOTE", EREMOTE, },
232 #endif
233 #if defined (ERESTART)
234  { "ERESTART", ERESTART, },
235 #endif
236 #if defined (EROFS)
237  { "EROFS", EROFS, },
238 #endif
239 #if defined (ESHUTDOWN)
240  { "ESHUTDOWN", ESHUTDOWN, },
241 #endif
242 #if defined (ESOCKTNOSUPPORT)
243  { "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, },
244 #endif
245 #if defined (ESPIPE)
246  { "ESPIPE", ESPIPE, },
247 #endif
248 #if defined (ESRCH)
249  { "ESRCH", ESRCH, },
250 #endif
251 #if defined (ESTALE)
252  { "ESTALE", ESTALE, },
253 #endif
254 #if defined (ETIMEDOUT)
255  { "ETIMEDOUT", ETIMEDOUT, },
256 #endif
257 #if defined (ETOOMANYREFS)
258  { "ETOOMANYREFS", ETOOMANYREFS, },
259 #endif
260 #if defined (ETXTBSY)
261  { "ETXTBSY", ETXTBSY, },
262 #endif
263 #if defined (EUSERS)
264  { "EUSERS", EUSERS, },
265 #endif
266 #if defined (EWOULDBLOCK)
267  { "EWOULDBLOCK", EWOULDBLOCK, },
268 #endif
269 #if defined (EXDEV)
270  { "EXDEV", EXDEV, },
271 #endif
272 
273  // Others (duplicates are OK).
274 
275 #if defined (EBADR)
276  { "EBADR", EBADR, },
277 #endif
278 #if defined (ENOMSG)
279  { "ENOMSG", ENOMSG, },
280 #endif
281 #if defined (ENOTSUP)
282  { "ENOTSUP", ENOTSUP, },
283 #endif
284 #if defined (ESTRPIPE)
285  { "ESTRPIPE", ESTRPIPE, },
286 #endif
287 #if defined (EADDRINUSE)
288  { "EADDRINUSE", EADDRINUSE, },
289 #endif
290 #if defined (EL3HLT)
291  { "EL3HLT", EL3HLT, },
292 #endif
293 #if defined (EBADF)
294  { "EBADF", EBADF, },
295 #endif
296 #if defined (ENAVAIL)
297  { "ENAVAIL", ENAVAIL, },
298 #endif
299 #if defined (ECHRNG)
300  { "ECHRNG", ECHRNG, },
301 #endif
302 #if defined (ENOTBLK)
303  { "ENOTBLK", ENOTBLK, },
304 #endif
305 #if defined (ENOTNAM)
306  { "ENOTNAM", ENOTNAM, },
307 #endif
308 #if defined (ELNRNG)
309  { "ELNRNG", ELNRNG, },
310 #endif
311 #if defined (ENOKEY)
312  { "ENOKEY", ENOKEY, },
313 #endif
314 #if defined (EXDEV)
315  { "EXDEV", EXDEV, },
316 #endif
317 #if defined (EBADE)
318  { "EBADE", EBADE, },
319 #endif
320 #if defined (EBADSLT)
321  { "EBADSLT", EBADSLT, },
322 #endif
323 #if defined (ECONNREFUSED)
324  { "ECONNREFUSED", ECONNREFUSED, },
325 #endif
326 #if defined (ENOSTR)
327  { "ENOSTR", ENOSTR, },
328 #endif
329 #if defined (EISCONN)
330  { "EISCONN", EISCONN, },
331 #endif
332 #if defined (EOVERFLOW)
333  { "EOVERFLOW", EOVERFLOW, },
334 #endif
335 #if defined (ENONET)
336  { "ENONET", ENONET, },
337 #endif
338 #if defined (EKEYREVOKED)
339  { "EKEYREVOKED", EKEYREVOKED, },
340 #endif
341 #if defined (EFBIG)
342  { "EFBIG", EFBIG, },
343 #endif
344 #if defined (ECONNRESET)
345  { "ECONNRESET", ECONNRESET, },
346 #endif
347 #if defined (ELIBMAX)
348  { "ELIBMAX", ELIBMAX, },
349 #endif
350 #if defined (EWOULDBLOCK)
351  { "EWOULDBLOCK", EWOULDBLOCK, },
352 #endif
353 #if defined (EREMOTEIO)
354  { "EREMOTEIO", EREMOTEIO, },
355 #endif
356 #if defined (ERFKILL)
357  { "ERFKILL", ERFKILL, },
358 #endif
359 #if defined (ENOPKG)
360  { "ENOPKG", ENOPKG, },
361 #endif
362 #if defined (ELIBSCN)
363  { "ELIBSCN", ELIBSCN, },
364 #endif
365 #if defined (EMEDIUMTYPE)
366  { "EMEDIUMTYPE", EMEDIUMTYPE, },
367 #endif
368 #if defined (EDESTADDRREQ)
369  { "EDESTADDRREQ", EDESTADDRREQ, },
370 #endif
371 #if defined (ENOTSOCK)
372  { "ENOTSOCK", ENOTSOCK, },
373 #endif
374 #if defined (EIO)
375  { "EIO", EIO, },
376 #endif
377 #if defined (EINPROGRESS)
378  { "EINPROGRESS", EINPROGRESS, },
379 #endif
380 #if defined (ERANGE)
381  { "ERANGE", ERANGE, },
382 #endif
383 #if defined (EADDRNOTAVAIL)
384  { "EADDRNOTAVAIL", EADDRNOTAVAIL, },
385 #endif
386 #if defined (EAFNOSUPPORT)
387  { "EAFNOSUPPORT", EAFNOSUPPORT, },
388 #endif
389 #if defined (EINTR)
390  { "EINTR", EINTR, },
391 #endif
392 #if defined (EILSEQ)
393  { "EILSEQ", EILSEQ, },
394 #endif
395 #if defined (EREMOTE)
396  { "EREMOTE", EREMOTE, },
397 #endif
398 #if defined (ENOMEM)
399  { "ENOMEM", ENOMEM, },
400 #endif
401 #if defined (ENETUNREACH)
402  { "ENETUNREACH", ENETUNREACH, },
403 #endif
404 #if defined (EPIPE)
405  { "EPIPE", EPIPE, },
406 #endif
407 #if defined (ENODATA)
408  { "ENODATA", ENODATA, },
409 #endif
410 #if defined (EUSERS)
411  { "EUSERS", EUSERS, },
412 #endif
413 #if defined (EOPNOTSUPP)
414  { "EOPNOTSUPP", EOPNOTSUPP, },
415 #endif
416 #if defined (EPROTO)
417  { "EPROTO", EPROTO, },
418 #endif
419 #if defined (EISNAM)
420  { "EISNAM", EISNAM, },
421 #endif
422 #if defined (ESPIPE)
423  { "ESPIPE", ESPIPE, },
424 #endif
425 #if defined (EALREADY)
426  { "EALREADY", EALREADY, },
427 #endif
428 #if defined (ENAMETOOLONG)
429  { "ENAMETOOLONG", ENAMETOOLONG, },
430 #endif
431 #if defined (ENOEXEC)
432  { "ENOEXEC", ENOEXEC, },
433 #endif
434 #if defined (EISDIR)
435  { "EISDIR", EISDIR, },
436 #endif
437 #if defined (EBADRQC)
438  { "EBADRQC", EBADRQC, },
439 #endif
440 #if defined (EEXIST)
441  { "EEXIST", EEXIST, },
442 #endif
443 #if defined (EDOTDOT)
444  { "EDOTDOT", EDOTDOT, },
445 #endif
446 #if defined (ELIBBAD)
447  { "ELIBBAD", ELIBBAD, },
448 #endif
449 #if defined (EOWNERDEAD)
450  { "EOWNERDEAD", EOWNERDEAD, },
451 #endif
452 #if defined (ESRCH)
453  { "ESRCH", ESRCH, },
454 #endif
455 #if defined (EFAULT)
456  { "EFAULT", EFAULT, },
457 #endif
458 #if defined (EAGAIN)
459  { "EAGAIN", EAGAIN, },
460 #endif
461 #if defined (EDEADLOCK)
462  { "EDEADLOCK", EDEADLOCK, },
463 #endif
464 #if defined (EXFULL)
465  { "EXFULL", EXFULL, },
466 #endif
467 #if defined (ENOPROTOOPT)
468  { "ENOPROTOOPT", ENOPROTOOPT, },
469 #endif
470 #if defined (ENETDOWN)
471  { "ENETDOWN", ENETDOWN, },
472 #endif
473 #if defined (EPROTOTYPE)
474  { "EPROTOTYPE", EPROTOTYPE, },
475 #endif
476 #if defined (EL2NSYNC)
477  { "EL2NSYNC", EL2NSYNC, },
478 #endif
479 #if defined (ENETRESET)
480  { "ENETRESET", ENETRESET, },
481 #endif
482 #if defined (EADV)
483  { "EADV", EADV, },
484 #endif
485 #if defined (EUCLEAN)
486  { "EUCLEAN", EUCLEAN, },
487 #endif
488 #if defined (EROFS)
489  { "EROFS", EROFS, },
490 #endif
491 #if defined (ESHUTDOWN)
492  { "ESHUTDOWN", ESHUTDOWN, },
493 #endif
494 #if defined (EMULTIHOP)
495  { "EMULTIHOP", EMULTIHOP, },
496 #endif
497 #if defined (EPROTONOSUPPORT)
498  { "EPROTONOSUPPORT", EPROTONOSUPPORT, },
499 #endif
500 #if defined (ENFILE)
501  { "ENFILE", ENFILE, },
502 #endif
503 #if defined (ENOLCK)
504  { "ENOLCK", ENOLCK, },
505 #endif
506 #if defined (ECONNABORTED)
507  { "ECONNABORTED", ECONNABORTED, },
508 #endif
509 #if defined (ECANCELED)
510  { "ECANCELED", ECANCELED, },
511 #endif
512 #if defined (EDEADLK)
513  { "EDEADLK", EDEADLK, },
514 #endif
515 #if defined (ENOLINK)
516  { "ENOLINK", ENOLINK, },
517 #endif
518 #if defined (ESRMNT)
519  { "ESRMNT", ESRMNT, },
520 #endif
521 #if defined (ENOTDIR)
522  { "ENOTDIR", ENOTDIR, },
523 #endif
524 #if defined (ETIME)
525  { "ETIME", ETIME, },
526 #endif
527 #if defined (EINVAL)
528  { "EINVAL", EINVAL, },
529 #endif
530 #if defined (ENOTTY)
531  { "ENOTTY", ENOTTY, },
532 #endif
533 #if defined (ENOANO)
534  { "ENOANO", ENOANO, },
535 #endif
536 #if defined (ELOOP)
537  { "ELOOP", ELOOP, },
538 #endif
539 #if defined (ENOENT)
540  { "ENOENT", ENOENT, },
541 #endif
542 #if defined (EPFNOSUPPORT)
543  { "EPFNOSUPPORT", EPFNOSUPPORT, },
544 #endif
545 #if defined (EBADMSG)
546  { "EBADMSG", EBADMSG, },
547 #endif
548 #if defined (ENOMEDIUM)
549  { "ENOMEDIUM", ENOMEDIUM, },
550 #endif
551 #if defined (EL2HLT)
552  { "EL2HLT", EL2HLT, },
553 #endif
554 #if defined (EDOM)
555  { "EDOM", EDOM, },
556 #endif
557 #if defined (EBFONT)
558  { "EBFONT", EBFONT, },
559 #endif
560 #if defined (EKEYEXPIRED)
561  { "EKEYEXPIRED", EKEYEXPIRED, },
562 #endif
563 #if defined (EMSGSIZE)
564  { "EMSGSIZE", EMSGSIZE, },
565 #endif
566 #if defined (ENOCSI)
567  { "ENOCSI", ENOCSI, },
568 #endif
569 #if defined (EL3RST)
570  { "EL3RST", EL3RST, },
571 #endif
572 #if defined (ENOSPC)
573  { "ENOSPC", ENOSPC, },
574 #endif
575 #if defined (EIDRM)
576  { "EIDRM", EIDRM, },
577 #endif
578 #if defined (ENOBUFS)
579  { "ENOBUFS", ENOBUFS, },
580 #endif
581 #if defined (ENOSYS)
582  { "ENOSYS", ENOSYS, },
583 #endif
584 #if defined (EHOSTDOWN)
585  { "EHOSTDOWN", EHOSTDOWN, },
586 #endif
587 #if defined (EBADFD)
588  { "EBADFD", EBADFD, },
589 #endif
590 #if defined (ENOSR)
591  { "ENOSR", ENOSR, },
592 #endif
593 #if defined (ENOTCONN)
594  { "ENOTCONN", ENOTCONN, },
595 #endif
596 #if defined (ESTALE)
597  { "ESTALE", ESTALE, },
598 #endif
599 #if defined (EDQUOT)
600  { "EDQUOT", EDQUOT, },
601 #endif
602 #if defined (EKEYREJECTED)
603  { "EKEYREJECTED", EKEYREJECTED, },
604 #endif
605 #if defined (ENOTRECOVERABLE)
606  { "ENOTRECOVERABLE", ENOTRECOVERABLE, },
607 #endif
608 #if defined (EMFILE)
609  { "EMFILE", EMFILE, },
610 #endif
611 #if defined (EACCES)
612  { "EACCES", EACCES, },
613 #endif
614 #if defined (EBUSY)
615  { "EBUSY", EBUSY, },
616 #endif
617 #if defined (E2BIG)
618  { "E2BIG", E2BIG, },
619 #endif
620 #if defined (EPERM)
621  { "EPERM", EPERM, },
622 #endif
623 #if defined (ELIBEXEC)
624  { "ELIBEXEC", ELIBEXEC, },
625 #endif
626 #if defined (ETOOMANYREFS)
627  { "ETOOMANYREFS", ETOOMANYREFS, },
628 #endif
629 #if defined (ELIBACC)
630  { "ELIBACC", ELIBACC, },
631 #endif
632 #if defined (ENOTUNIQ)
633  { "ENOTUNIQ", ENOTUNIQ, },
634 #endif
635 #if defined (ECOMM)
636  { "ECOMM", ECOMM, },
637 #endif
638 #if defined (ERESTART)
639  { "ERESTART", ERESTART, },
640 #endif
641 #if defined (EUNATCH)
642  { "EUNATCH", EUNATCH, },
643 #endif
644 #if defined (ESOCKTNOSUPPORT)
645  { "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, },
646 #endif
647 #if defined (ETIMEDOUT)
648  { "ETIMEDOUT", ETIMEDOUT, },
649 #endif
650 #if defined (ENXIO)
651  { "ENXIO", ENXIO, },
652 #endif
653 #if defined (ENODEV)
654  { "ENODEV", ENODEV, },
655 #endif
656 #if defined (ETXTBSY)
657  { "ETXTBSY", ETXTBSY, },
658 #endif
659 #if defined (EHWPOISON)
660  { "EHWPOISON", EHWPOISON, },
661 #endif
662 #if defined (EMLINK)
663  { "EMLINK", EMLINK, },
664 #endif
665 #if defined (ECHILD)
666  { "ECHILD", ECHILD, },
667 #endif
668 #if defined (EHOSTUNREACH)
669  { "EHOSTUNREACH", EHOSTUNREACH, },
670 #endif
671 #if defined (EREMCHG)
672  { "EREMCHG", EREMCHG, },
673 #endif
674 #if defined (ENOTEMPTY)
675  { "ENOTEMPTY", ENOTEMPTY, },
676 #endif
677 
678 
679  { 0, 0, },
680  };
681 
682  // Stuff them all in a map for fast access.
683 
684  errno_struct *ptr = errno_codes;
685 
686  while (ptr->name)
687  {
688  errno_tbl[ptr->name] = ptr->value;
689  ptr++;
690  }
691 }
692 
693 bool
695 {
696  bool retval = true;
697 
698  if (! instance)
699  {
700  instance = new octave_errno ();
701 
702  if (instance)
704  }
705 
706  if (! instance)
707  {
708  ::error ("unable to create errno object!");
709 
710  retval = false;
711  }
712 
713  return retval;
714 }
715 
716 int
717 octave_errno::lookup (const std::string& name)
718 {
719  return (instance_ok ()) ? instance->do_lookup (name) : -1;
720 }
721 
724 {
725  return (instance_ok ()) ? instance->do_list () : octave_scalar_map ();
726 }
727 
728 int
729 octave_errno::do_lookup (const std::string& name)
730 {
731  return (errno_tbl.find (name) != errno_tbl.end ()) ? errno_tbl[name] : -1;
732 }
733 
736 {
737  octave_scalar_map retval;
738 
739  for (std::map<std::string, int>::const_iterator p = errno_tbl.begin ();
740  p != errno_tbl.end ();
741  p++)
742  {
743  retval.assign (p->first, p->second);
744  }
745 
746  return retval;
747 }