annotate libinterp/corefcn/oct-errno.h @ 23084:ef4d915df748

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Mon, 23 Jan 2017 14:27:48 -0500
parents 87e3163f6c87 e9a0469dedd9
children 092078913d54
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
1 // oct-errno.h.in
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
2 /*
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
3
22323
bac0d6f07a3e maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
4 Copyright (C) 2005-2016 John W. Eaton
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
5
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
7
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
9 under the terms of the GNU General Public License as published by
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
10 the Free Software Foundation; either version 3 of the License, or
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
11 (at your option) any later version.
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
12
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
13 Octave is distributed in the hope that it will be useful, but
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
14 WITHOUT ANY WARRANTY; without even the implied warranty of
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22407
diff changeset
16 GNU General Public License for more details.
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
17
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5465
diff changeset
19 along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 5465
diff changeset
20 <http://www.gnu.org/licenses/>.
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
21
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
22 */
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
23
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
24 #if ! defined (octave_oct_errno_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17744
diff changeset
25 #define octave_oct_errno_h 1
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
26
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
27 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
28
8020
1d2bcc163c4d oct-errno.h: include <cerrno>
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
29 #include <cerrno>
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
30 #include <map>
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
31 #include <string>
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
32
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
33 #include "oct-map.h"
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
34
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
35 class
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
36 octave_errno
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
37 {
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
38 protected:
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
39
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
40 octave_errno (void);
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
41
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
42 public:
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
43
22868
87e3163f6c87 use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents: 22755
diff changeset
44 ~octave_errno (void) = default;
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
45
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
46 static bool instance_ok (void);
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
47
13992
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
48 static void cleanup_instance (void) { delete instance; instance = 0; }
e1f76bfe0452 apply singleton_cleanup to a few more classes
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
49
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
50 static int lookup (const std::string& name);
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
51
11057
4d9f310b32bb replace Octave_map->octave_map in oct-errno
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
52 static octave_scalar_map list (void);
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
53
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
54 static int get (void) { return errno; }
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
55
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
56 static int set (int val)
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
57 {
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
58 int retval = errno;
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
59 errno = val;
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
60 return retval;
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
61 }
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
62
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
63 private:
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
64
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
65 std::map<std::string, int> errno_tbl;
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
66
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
67 static octave_errno *instance;
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
68
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
69 int do_lookup (const std::string& name);
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
70
11057
4d9f310b32bb replace Octave_map->octave_map in oct-errno
Jaroslav Hajek <highegg@gmail.com>
parents: 10160
diff changeset
71 octave_scalar_map do_list (void);
5465
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
72 };
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
73
d6163c0effd5 [project @ 2005-09-23 15:42:48 by jwe]
jwe
parents:
diff changeset
74 #endif