Mercurial > octave
annotate libinterp/octave-value/ov-mex-fcn.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 | f75d289645ec e9a0469dedd9 |
children | 092078913d54 |
rev | line source |
---|---|
5864 | 1 /* |
2 | |
22323
bac0d6f07a3e
maint: Update copyright notices for 2016.
John W. Eaton <jwe@octave.org>
parents:
22022
diff
changeset
|
3 Copyright (C) 1996-2016 John W. Eaton |
5864 | 4 |
5 This file is part of Octave. | |
6 | |
7 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
|
8 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
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
5864 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 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
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
5864 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
5864 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_ov_mex_fcn_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #define octave_ov_mex_fcn_h 1 |
5864 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
5864 | 28 #include <string> |
29 | |
30 #include "oct-shlib.h" | |
31 | |
32 #include "ov-fcn.h" | |
33 #include "ov-builtin.h" | |
34 #include "ov-typeinfo.h" | |
35 | |
36 class octave_value; | |
37 class octave_value_list; | |
38 | |
39 // Dynamically-linked functions. | |
40 | |
41 class | |
42 octave_mex_function : public octave_function | |
43 { | |
44 public: | |
45 | |
12123
9ea6f69259d7
more constructor initialization fixes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
46 octave_mex_function (void) |
12174 | 47 : mex_fcn_ptr (), exit_fcn_ptr (), have_fmex (), sh_lib (), |
12123
9ea6f69259d7
more constructor initialization fixes
Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
parents:
11523
diff
changeset
|
48 t_checked (), system_fcn_file () { } |
5864 | 49 |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21730
diff
changeset
|
50 octave_mex_function (void *fptr, bool fmex, const octave::dynamic_library& shl, |
21017
93748bcaec17
maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
51 const std::string& nm = ""); |
5864 | 52 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
53 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
54 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
55 octave_mex_function (const octave_mex_function& fn) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
56 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
57 octave_mex_function& operator = (const octave_mex_function& fn) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
58 |
5864 | 59 ~octave_mex_function (void); |
60 | |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
61 octave_value subsref (const std::string& type, |
10313 | 62 const std::list<octave_value_list>& idx) |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
63 { |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
64 octave_value_list tmp = subsref (type, idx, 1); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
65 return tmp.length () > 0 ? tmp(0) : octave_value (); |
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
66 } |
5864 | 67 |
68 octave_value_list subsref (const std::string& type, | |
10313 | 69 const std::list<octave_value_list>& idx, |
70 int nargout); | |
5864 | 71 |
72 octave_function *function_value (bool = false) { return this; } | |
73 | |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
74 const octave_function *function_value (bool = false) const { return this; } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7651
diff
changeset
|
75 |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
76 void mark_fcn_file_up_to_date (const octave::sys::time& t) { t_checked = t; } |
5864 | 77 |
78 std::string fcn_file_name (void) const; | |
79 | |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
80 octave::sys::time time_parsed (void) const; |
5864 | 81 |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 octave::sys::time time_checked (void) const { return t_checked; } |
5864 | 83 |
84 bool is_system_fcn_file (void) const { return system_fcn_file; } | |
85 | |
86 bool is_builtin_function (void) const { return false; } | |
87 | |
88 bool is_mex_function (void) const { return true; } | |
89 | |
90 octave_value_list | |
91 do_multi_index_op (int nargout, const octave_value_list& args); | |
92 | |
6068 | 93 void atexit (void (*fcn) (void)) { exit_fcn_ptr = fcn; } |
94 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21730
diff
changeset
|
95 octave::dynamic_library get_shlib (void) const |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
96 { return sh_lib; } |
9960
5f3c10ecb150
implement get_current_shlib and octave_auto_shlib
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
97 |
5864 | 98 private: |
99 | |
100 void *mex_fcn_ptr; | |
101 | |
6068 | 102 void (*exit_fcn_ptr) (void); |
103 | |
5864 | 104 bool have_fmex; |
105 | |
21750
6720e5a220ba
use namespace for octave_shlib class
John W. Eaton <jwe@octave.org>
parents:
21730
diff
changeset
|
106 octave::dynamic_library sh_lib; |
5864 | 107 |
108 // The time the file was last checked to see if it needs to be | |
109 // parsed again. | |
21730
30c53770f47e
use namespace for system time classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
110 mutable octave::sys::time t_checked; |
5864 | 111 |
112 // True if this function came from a file that is considered to be a | |
113 // system function. This affects whether we check the time stamp | |
114 // on the file to see if it has changed. | |
115 bool system_fcn_file; | |
116 | |
117 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA | |
118 }; | |
119 | |
120 #endif |