1 // Copyright (C) 2017 Carnë Draug <carandraug@octave.org>
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 3 of the
6 // License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, see
15 // <http://www.gnu.org/licenses/>.
16 
17 // Core is going through a bunch of changes, and moving a lot of
18 // functions into the octave namespace and deprecating thw old
19 // functions.  We want to be compatible with older versions and we
20 // don't want to scare users with deprecation warnings so we have our
21 // own wrappers so nothing breaks.
22 //
23 // We don't want to have a file per function we need to wrap; we don't
24 // want to repeat the wrapper in each file that needs it; we don't
25 // want to disable the deprecation warnings (so that we get warnings
26 // next time we something else gets deprecated); and we don't want to
27 // include all needed headers.
28 //
29 // It is the job of the file that includes this to include the
30 // required headers, at least as long as core only changes the
31 // namespace and not the header file.
32 //
33 // This wrappers are all temporary until we no longer support the
34 // Octave version that made the change.
35 
36 #include "config.h"
37 
38 namespace octave_image
39 {
40   // Temporary wrapper until we no longer support Octave 4.2 (bug #50180)
41 #if defined WANTS_FEVAL && ! defined HAS_FEVAL
42 #define HAS_FEVAL 1
43   inline octave_value_list
44   feval (const std::string& name,
45          const octave_value_list& args,
46          int nargout = 0)
47   {
48 #if defined HAVE_FEVAL_IN_OCTAVE_NAMESPACE
49     return octave::feval (name, args, nargout);
50 #else
51     return ::feval (name, args, nargout);
52 #endif
53   }
54 #endif
55 
56   // Temporary wrapper until we no longer support Octave 4.2
57 #if defined WANTS_OCTAVE_IMAGE_VALUE && ! defined HAS_OCTAVE_IMAGE_VALUE
58 #define HAS_OCTAVE_IMAGE_VALUE 1
59   class
60   value : public octave_value
61   {
62   public:
value(const octave_value & a)63     value (const octave_value& a) : octave_value (a) {}
64 
65 #if ! defined HAVE_OCTAVE_STYLE_IS_FUNCTIONS
66 
islogical(void)67     bool islogical (void) const
68     { return is_bool_type (); }
69 
iscomplex(void)70     bool iscomplex (void) const
71     { return is_complex_type (); }
72 
isempty(void)73     bool isempty (void) const
74     { return is_empty (); }
75 
isfloat(void)76     bool isfloat (void) const
77     { return is_float_type (); }
78 
isnumeric(void)79     bool isnumeric (void) const
80     { return is_numeric_type (); }
81 
isreal(void)82     bool isreal (void) const
83     { return is_real_type (); }
84 
85 #endif
86   };
87 #endif
88 }
89