comparison src/ov-fcn-handle.h @ 4930:bdb307dc8613

[project @ 2004-08-05 04:55:26 by jwe]
author jwe
date Thu, 05 Aug 2004 04:55:26 +0000
parents 90f51232d751
children cd58733c326b
comparison
equal deleted inserted replaced
4929:585e9a8c2ef8 4930:bdb307dc8613
42 42
43 class 43 class
44 octave_fcn_handle : public octave_base_value 44 octave_fcn_handle : public octave_base_value
45 { 45 {
46 public: 46 public:
47 enum fcn_type { fcn_handle = 1, fcn_inline = 2 };
47 48
48 octave_fcn_handle (void) : fcn (0), nm () { } 49 octave_fcn_handle (void)
50 : typ (fcn_handle), fcn (), nm (), iftext (), ifargs () { }
49 51
50 octave_fcn_handle (octave_function *f, const std::string& n) 52 octave_fcn_handle (const octave_value& f, const std::string& n)
51 : fcn (f), nm (n) { } 53 : typ (fcn_handle), fcn (f), nm (n), iftext (), ifargs () { }
54
55 octave_fcn_handle (const std::string& f, const string_vector& a,
56 const std::string& n = std::string ());
52 57
53 ~octave_fcn_handle (void) { } 58 ~octave_fcn_handle (void) { }
54 59
55 octave_value subsref (const std::string&, 60 octave_value subsref (const std::string&,
56 const std::list<octave_value_list>&) 61 const std::list<octave_value_list>&)
65 70
66 bool is_defined (void) const { return true; } 71 bool is_defined (void) const { return true; }
67 72
68 bool is_function_handle (void) const { return true; } 73 bool is_function_handle (void) const { return true; }
69 74
70 octave_function *function_value (bool = false) { return fcn; } 75 octave_function *function_value (bool = false)
76 { return fcn.function_value (); }
71 77
72 std::string name (void) const { return nm; } 78 std::string inline_fcn_name (void) const { return nm; }
79
80 std::string inline_fcn_text (void) const { return iftext; }
81
82 string_vector inline_fcn_arg_names (void) const { return ifargs; }
83
84 bool is_inline (void) const { return (typ == fcn_inline); }
73 85
74 octave_fcn_handle *fcn_handle_value (bool = false) { return this; } 86 octave_fcn_handle *fcn_handle_value (bool = false) { return this; }
87
88 octave_value convert_to_str_internal (bool, bool) const;
75 89
76 void print (std::ostream& os, bool pr_as_read_syntax = false) const; 90 void print (std::ostream& os, bool pr_as_read_syntax = false) const;
77 91
78 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; 92 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
79 93
87 101
88 DECLARE_OCTAVE_ALLOCATOR 102 DECLARE_OCTAVE_ALLOCATOR
89 103
90 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 104 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
91 105
106 // The type of function handle
107 fcn_type typ;
108
92 // The function we are handling. 109 // The function we are handling.
93 octave_function *fcn; 110 octave_value fcn;
94 111
95 // The name of the handle, including the "@". 112 // The name of the handle, including the "@".
96 std::string nm; 113 std::string nm;
114
115 // The expression of an inline function
116 std::string iftext;
117
118 // The args of an inline function
119 string_vector ifargs;
97 }; 120 };
98 121
99 extern octave_value make_fcn_handle (const std::string& nm); 122 extern octave_value make_fcn_handle (const std::string& nm);
100 123
101 #endif 124 #endif