From: John W. E. <jw...@be...> - 2002-10-24 15:06:54
|
On 23-Oct-2002, Dirk Eddelbuettel <ed...@de...> wrote: | Thanks -- I am currently uploading 2.1.37, incl the small mkopt.pl patch, to | Debian. | | But even with the patch, building octave-forge fails: | | /usr/bin/g++ -c -fPIC -I/usr/include/octave-2.1.37 | -I/usr/include/octave-2.1.37/octave -I/usr/include -mieee-fp | -fno-implicit-templates -O2 -DHAVE_OCTAVE_21 getfield.cc -o getfield.o | getfield.cc: In function class octave_value_list Fgetfield(const | octave_value_list &, int)': | getfield.cc:40: no matching function for call to | octave_value::do_struct_elt_index_op (string &, bool)' | make[3]: *** [getfield.oct] Error 1 | make[3]: Leaving directory | /home/edd/src/debian/octave-forge-2002.05.09/main/struct' | make[2]: *** [struct/] Error 2 | make[2]: Leaving directory /home/edd/src/debian/octave-forge-2002.05.09/main' | make[1]: *** [main/] Error 2 | make[1]: Leaving directory /home/edd/src/debian/octave-forge-2002.05.09' | make: *** [build-stamp] Error 2 | | This is using the 2002.05.09 release of octave-forge. Is there something I | need from CVS to deal with this? There have been a lot of changes to the parts of Octave that handle indexing and indexed assignment. I'd like to include this functionality in Octave, but it should probably wait until structure arrays can be multidimensional. For now, I think the following patch should make getfield.cc compile and prevent setfield from creating invalid structures. jwe --- getfield.cc~ 2002-10-24 09:48:30.000000000 -0500 +++ getfield.cc 2002-10-24 09:53:29.000000000 -0500 @@ -36,12 +36,14 @@ for (int i = 1; i<nargin; i++) { if (args(i).is_string ()) { - std::string s = args(i).string_value (); - octave_value tmp = args(0).do_struct_elt_index_op (s, true); + octave_value tmp = args(0).subsref (".", args(i)); if (tmp.is_defined ()) retval(i-1) = tmp; - else error ("structure has no member `%s'", s.c_str ()); + else { + std::string s = args(i).string_value (); + error ("structure has no member `%s'", s.c_str ()); + } } else error ("argument number %i is not a string",i+1); --- setfield.cc~ 2002-10-24 09:51:26.000000000 -0500 +++ setfield.cc 2002-10-24 10:02:29.000000000 -0500 @@ -57,7 +57,7 @@ if (args(i).is_string ()) { std::string s = args(i).string_value (); - tmp [s] = args(i+1); + tmp.assign (s, args(i+1)); } else error ("argument number %i is not a string",i+1); } |