5864
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_mex_function_h) |
|
25 #define octave_mex_function_h 1 |
|
26 |
|
27 #include <string> |
|
28 |
|
29 #include "oct-shlib.h" |
|
30 |
|
31 #include "ov-fcn.h" |
|
32 #include "ov-builtin.h" |
|
33 #include "ov-typeinfo.h" |
|
34 |
|
35 class octave_shlib; |
|
36 |
|
37 class octave_value; |
|
38 class octave_value_list; |
|
39 |
|
40 // Dynamically-linked functions. |
|
41 |
|
42 class |
|
43 octave_mex_function : public octave_function |
|
44 { |
|
45 public: |
|
46 |
|
47 octave_mex_function (void) { } |
|
48 |
|
49 octave_mex_function (void *fptr, bool fmex, const octave_shlib& shl, |
|
50 const std::string& nm = std::string ()); |
|
51 |
|
52 ~octave_mex_function (void); |
|
53 |
|
54 octave_value subsref (const std::string&, |
|
55 const std::list<octave_value_list>&) |
|
56 { |
|
57 panic_impossible (); |
|
58 return octave_value (); |
|
59 } |
|
60 |
|
61 octave_value_list subsref (const std::string& type, |
|
62 const std::list<octave_value_list>& idx, |
|
63 int nargout); |
|
64 |
|
65 octave_function *function_value (bool = false) { return this; } |
|
66 |
|
67 void mark_fcn_file_up_to_date (const octave_time& t) { t_checked = t; } |
|
68 |
|
69 std::string fcn_file_name (void) const; |
|
70 |
|
71 octave_time time_parsed (void) const; |
|
72 |
|
73 octave_time time_checked (void) const { return t_checked; } |
|
74 |
|
75 bool is_system_fcn_file (void) const { return system_fcn_file; } |
|
76 |
|
77 bool is_builtin_function (void) const { return false; } |
|
78 |
|
79 bool is_mex_function (void) const { return true; } |
|
80 |
|
81 octave_value_list |
|
82 do_multi_index_op (int nargout, const octave_value_list& args); |
|
83 |
|
84 private: |
|
85 |
|
86 void *mex_fcn_ptr; |
|
87 |
|
88 bool have_fmex; |
|
89 |
|
90 octave_shlib sh_lib; |
|
91 |
|
92 // The time the file was last checked to see if it needs to be |
|
93 // parsed again. |
|
94 mutable octave_time t_checked; |
|
95 |
|
96 // True if this function came from a file that is considered to be a |
|
97 // system function. This affects whether we check the time stamp |
|
98 // on the file to see if it has changed. |
|
99 bool system_fcn_file; |
|
100 |
|
101 // No copying! |
|
102 |
|
103 octave_mex_function (const octave_mex_function& fn); |
|
104 |
|
105 octave_mex_function& operator = (const octave_mex_function& fn); |
|
106 |
|
107 DECLARE_OCTAVE_ALLOCATOR |
|
108 |
|
109 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
|
110 }; |
|
111 |
|
112 #endif |
|
113 |
|
114 /* |
|
115 ;;; Local Variables: *** |
|
116 ;;; mode: C++ *** |
|
117 ;;; End: *** |
|
118 */ |