diff -r 4de199e1e5c0 liboctave/Array.cc --- a/liboctave/Array.cc Tue May 19 15:59:37 2009 +0200 +++ b/liboctave/Array.cc Tue May 19 15:59:51 2009 +0200 @@ -2688,16 +2688,7 @@ // << prefix << "cols: " << cols () << "\n"; } -template -void Array::instantiation_guard () -{ - // This guards against accidental implicit instantiations. - // Array instances should always be explicit and use INSTANTIATE_ARRAY. - T::__xXxXx__(); -} - #define INSTANTIATE_ARRAY(T, API) \ - template <> void Array::instantiation_guard () { } \ template class API Array /* diff -r 4de199e1e5c0 liboctave/Array.h --- a/liboctave/Array.h Tue May 19 15:59:37 2009 +0200 +++ b/liboctave/Array.h Tue May 19 15:59:51 2009 +0200 @@ -629,9 +629,6 @@ } template friend class Array; - -private: - static void instantiation_guard (); }; #endif diff -r 4de199e1e5c0 liboctave/ArrayN-idx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/liboctave/ArrayN-idx.h Tue May 19 15:59:51 2009 +0200 @@ -0,0 +1,72 @@ +// Template array classes +/* + +Copyright (C) 2000, 2001, 2002, 2003, 2005, 2006, 2007 John W. Eaton + +This file is part of Octave. + +Octave is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3 of the License, or (at your +option) any later version. + +Octave is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Octave; see the file COPYING. If not, see +. + +*/ + +#include "Range.h" +#include "idx-vector.h" +#include "lo-error.h" + +#if 0 + +template +ArrayN +ArrayN::value (void) +{ + ArrayN retval; + + int n_idx = index_count (); + + if (n_idx > 1) + { + Array ra_idx (n_idx); + + idx_vector *tmp = get_idx (); + + for (int i = 0; i < n_idx; i++) + ra_idx(i) = tmp[i]; + + return index (ra_idx); + } + else if (n_idx == 1) + { + idx_vector *tmp = get_idx (); + + idx_vector ra_idx = tmp[0]; + + return index (ra_idx); + } + else + (*current_liboctave_error_handler) + ("invalid number of indices for array expression"); + + clear_index (); + + return retval; +} + +#endif + +/* +;;; Local Variables: *** +;;; mode: C++ *** +;;; End: *** +*/ diff -r 4de199e1e5c0 liboctave/ArrayN.cc --- a/liboctave/ArrayN.cc Tue May 19 15:59:37 2009 +0200 +++ b/liboctave/ArrayN.cc Tue May 19 15:59:51 2009 +0200 @@ -31,6 +31,7 @@ #include "Array-util.h" #include "ArrayN.h" +#include "ArrayN-idx.h" #include "idx-vector.h" #include "lo-error.h" diff -r 4de199e1e5c0 liboctave/ChangeLog --- a/liboctave/ChangeLog Tue May 19 15:59:37 2009 +0200 +++ b/liboctave/ChangeLog Tue May 19 15:59:51 2009 +0200 @@ -1,15 +1,3 @@ -2009-05-15 Jaroslav Hajek - - * Array.cc (Array::instantiation_guard): New function - (INSTANTIATE_ARRAY): Always override it here. - * Array.h: Declare it. - -2009-05-15 Jaroslav Hajek - - * ArrayN-idx.h: Remove file. - * ArrayN.cc: Don't include it. - * MArrayN.cc: Dtto. - 2009-05-09 Jaroslav Hajek * Array-util.cc (zero_dims_inquire): Move j++ out of branch. diff -r 4de199e1e5c0 liboctave/MArrayN.cc --- a/liboctave/MArrayN.cc Tue May 19 15:59:37 2009 +0200 +++ b/liboctave/MArrayN.cc Tue May 19 15:59:51 2009 +0200 @@ -26,6 +26,7 @@ #include "MArrayN.h" #include "Array-util.h" +#include "ArrayN-idx.h" #include "lo-error.h" #include "MArray-defs.h" diff -r 4de199e1e5c0 src/oct-stream.cc --- a/src/oct-stream.cc Tue May 19 15:59:37 2009 +0200 +++ b/src/oct-stream.cc Tue May 19 15:59:51 2009 +0200 @@ -30,12 +30,15 @@ #include #include -#include #include #include #include #include +#include +#include + +#include #include "byte-swap.h" #include "lo-ieee.h" @@ -3267,21 +3270,25 @@ typedef octave_value (*read_fptr) (octave_stream&, octave_idx_type, octave_idx_type, octave_idx_type, octave_idx_type, bool, bool, oct_mach_info::float_format ffmt, octave_idx_type&); +NO_INSTANTIATE_ARRAY_SORT (read_fptr); +INSTANTIATE_ARRAY (read_fptr,); +template class Array2; + #define FILL_TABLE_ROW(R, VAL_T) \ - read_fptr_table[R][oct_data_conv::dt_int8] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_uint8] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_int16] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_uint16] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_int32] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_uint32] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_int64] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_uint64] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_single] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_double] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_char] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_schar] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_uchar] = do_read; \ - read_fptr_table[R][oct_data_conv::dt_logical] = do_read + read_fptr_table(R,oct_data_conv::dt_int8) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_uint8) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_int16) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_uint16) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_int32) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_uint32) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_int64) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_uint64) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_single) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_double) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_char) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_schar) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_uchar) = do_read; \ + read_fptr_table(R,oct_data_conv::dt_logical) = do_read octave_value octave_stream::read (const Array& size, octave_idx_type block_size, @@ -3294,14 +3301,10 @@ // Table function pointers for return types x read types. - static read_fptr read_fptr_table[oct_data_conv::dt_unknown][14]; + static Array2 read_fptr_table (oct_data_conv::dt_unknown, 14, 0); if (! initialized) { - for (int i = 0; i < oct_data_conv::dt_unknown; i++) - for (int j = 0; j < 14; j++) - read_fptr_table[i][j] = 0; - FILL_TABLE_ROW (oct_data_conv::dt_int8, int8NDArray); FILL_TABLE_ROW (oct_data_conv::dt_uint8, uint8NDArray); FILL_TABLE_ROW (oct_data_conv::dt_int16, int16NDArray); @@ -3348,7 +3351,7 @@ if (ffmt == oct_mach_info::flt_fmt_unknown) ffmt = float_format (); - read_fptr fcn = read_fptr_table[output_type][input_type]; + read_fptr fcn = read_fptr_table (output_type, input_type); bool do_float_fmt_conv = ((input_type == oct_data_conv::dt_double || input_type == oct_data_conv::dt_single)