comparison src/ov-fcn-handle.cc @ 5663:775e065f7dc4

[project @ 2006-03-13 21:30:06 by jwe]
author jwe
date Mon, 13 Mar 2006 21:30:07 +0000
parents d2979f3da3cb
children 8d7162924bd3
comparison
equal deleted inserted replaced
5662:1c334f7e7bef 5663:775e065f7dc4
29 #include <vector> 29 #include <vector>
30 30
31 #include "defun.h" 31 #include "defun.h"
32 #include "error.h" 32 #include "error.h"
33 #include "gripes.h" 33 #include "gripes.h"
34 #include "input.h"
34 #include "oct-map.h" 35 #include "oct-map.h"
35 #include "ov-base.h" 36 #include "ov-base.h"
36 #include "ov-fcn-handle.h" 37 #include "ov-fcn-handle.h"
37 #include "ov-usr-fcn.h" 38 #include "ov-usr-fcn.h"
38 #include "pr-output.h" 39 #include "pr-output.h"
54 55
55 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_handle, 56 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_fcn_handle,
56 "function handle", 57 "function handle",
57 "function handle"); 58 "function handle");
58 59
60 void
61 octave_fcn_handle::reload_warning (const std::string& fcn_type) const
62 {
63 if (warn_reload)
64 {
65 warn_reload = false;
66
67 warning ("reloading %s functions referenced by function handles is not implemented",
68 fcn_type.c_str ());
69 }
70 }
71
59 octave_value_list 72 octave_value_list
60 octave_fcn_handle::subsref (const std::string& type, 73 octave_fcn_handle::subsref (const std::string& type,
61 const std::list<octave_value_list>& idx, 74 const std::list<octave_value_list>& idx,
62 int nargout) 75 int nargout)
63 { 76 {
67 { 80 {
68 case '(': 81 case '(':
69 { 82 {
70 octave_function *f = function_value (); 83 octave_function *f = function_value ();
71 84
72 // XXX FIXME XXX -- need to check to see if the function has a 85 if (f && f->time_checked () < Vlast_prompt_time)
73 // new definition. The following does not work for function 86 {
74 // handles that refer to subfunctions or functions defined on 87 std::string ff_nm = f->fcn_file_name ();
75 // the command line. 88
76 // 89 time_t tp = f->time_parsed ();
77 // if (function_out_of_date (f)) 90
78 // { 91 if (ff_nm.empty ())
79 // octave_value tmp = lookup_function (fcn_name ()); 92 {
80 // 93 // XXX FIXME XXX -- need to handle inline and
81 // octave_function *ftmp = tmp.function_value (true); 94 // command-line functions here.
82 // 95 }
83 // if (ftmp) 96 else
84 // f = ftmp; 97 {
85 // } 98 if (fcn_out_of_date (f, ff_nm, tp))
99 {
100 // XXX FIXME XXX -- there is currently no way to
101 // parse a .m file or reload a .oct file that
102 // leaves the fbi symbol table untouched. We need
103 // a function that will parse the file and return
104 // a pointer to the new function definition
105 // without altering the symbol table.
106
107 if (f->is_nested_function ())
108 reload_warning ("nested");
109 else
110 reload_warning ("functions");
111 }
112 }
113 }
86 114
87 if (f) 115 if (f)
88 retval = f->subsref (type, idx, nargout); 116 retval = f->subsref (type, idx, nargout);
89 else 117 else
90 error ("invalid function handle"); 118 error ("invalid function handle");