comparison src/ov-cell.cc @ 4994:48d0defe9445

[project @ 2004-09-15 20:31:31 by jwe]
author jwe
date Wed, 15 Sep 2004 20:31:31 +0000
parents 44046bbaa52c
children 34a904ac130d
comparison
equal deleted inserted replaced
4993:761b8d760785 4994:48d0defe9445
56 56
57 DEFINE_OCTAVE_ALLOCATOR (octave_cell); 57 DEFINE_OCTAVE_ALLOCATOR (octave_cell);
58 58
59 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell"); 59 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_cell, "cell", "cell");
60 60
61 octave_value 61 octave_value_list
62 octave_cell::subsref (const std::string& type, 62 octave_cell::subsref (const std::string& type,
63 const std::list<octave_value_list>& idx) 63 const std::list<octave_value_list>& idx, int nargout)
64 { 64 {
65 octave_value retval; 65 octave_value_list retval;
66 66
67 switch (type[0]) 67 switch (type[0])
68 { 68 {
69 case '(': 69 case '(':
70 retval = do_index_op (idx.front ()); 70 retval(0) = do_index_op (idx.front ());
71 break; 71 break;
72 72
73 case '{': 73 case '{':
74 { 74 {
75 octave_value tmp = do_index_op (idx.front ()); 75 octave_value tmp = do_index_op (idx.front ());
77 if (! error_state) 77 if (! error_state)
78 { 78 {
79 Cell tcell = tmp.cell_value (); 79 Cell tcell = tmp.cell_value ();
80 80
81 if (tcell.length () == 1) 81 if (tcell.length () == 1)
82 retval = tcell(0,0); 82 retval(0) = tcell(0,0);
83 else 83 else
84 { 84 {
85 int n = tcell.numel (); 85 int n = tcell.numel ();
86 86
87 octave_value_list lst (n, octave_value ()); 87 octave_value_list lst (n, octave_value ());
90 { 90 {
91 OCTAVE_QUIT; 91 OCTAVE_QUIT;
92 lst(i) = tcell(i); 92 lst(i) = tcell(i);
93 } 93 }
94 94
95 retval = octave_value (lst, true); 95 retval(0) = octave_value (lst, true);
96 } 96 }
97 } 97 }
98 } 98 }
99 break; 99 break;
100 100
107 107
108 default: 108 default:
109 panic_impossible (); 109 panic_impossible ();
110 } 110 }
111 111
112 return retval.next_subsref (type, idx); 112 // XXX FIXME XXX -- perhaps there should be an
113 // octave_value_list::next_subsref member function? See also
114 // octave_user_function::subsref.
115
116 if (idx.size () > 1)
117 retval = retval(0).next_subsref (nargout, type, idx);
118
119 return retval;
113 } 120 }
114 121
115 octave_value 122 octave_value
116 octave_cell::subsasgn (const std::string& type, 123 octave_cell::subsasgn (const std::string& type,
117 const std::list<octave_value_list>& idx, 124 const std::list<octave_value_list>& idx,