view src/ov-base.cc @ 2962:5e0fe4c5d52f

[project @ 1997-05-12 03:13:57 by jwe]
author jwe
date Mon, 12 May 1997 03:21:56 +0000
parents ac3368dba5d3
children ebbc34ff7f66
line wrap: on
line source

/*

Copyright (C) 1996, 1997 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 2, 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, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

#if defined (__GNUG__)
#pragma implementation
#endif

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream.h>

#include "lo-ieee.h"

#include "gripes.h"
#include "oct-map.h"
#include "oct-var-ref.h"
#include "ops.h"
#include "ov-base.h"
#include "ov-scalar.h"
#include "ov-re-mat.h"
#include "ov-complex.h"
#include "ov-cx-mat.h"
#include "ov-ch-mat.h"
#include "ov-str-mat.h"
#include "ov-range.h"
#include "ov-list.h"
#include "variables.h"

int octave_base_value::t_id = -1;

const string octave_base_value::t_name ("<unknown type>");

octave_value
octave_base_value::do_index_op (const octave_value_list&) const
{
  string nm = type_name ();
  error ("can't perform indexing operations for %s type", nm.c_str ());
  return octave_value ();
}

idx_vector
octave_base_value::index_vector (void) const
{
  string nm = type_name ();
  error ("%s type invalid as index value", nm.c_str ());
  return idx_vector ();
}

octave_value
octave_base_value::do_struct_elt_index_op (const string&,
					   const octave_value_list&,
					   bool)
{
  string nm = type_name ();
  error ("can't perform indexed structure reference operations for %s type",
	 nm.c_str ());
  return octave_value ();
}

octave_value
octave_base_value::do_struct_elt_index_op (const string&, bool)
{
  string nm = type_name ();
  error ("can't perform structure reference operations for %s type",
	 nm.c_str ());
  return octave_value ();
}

octave_variable_reference
octave_base_value::struct_elt_ref (octave_value *, const string&)
{
  string nm = type_name ();
  error ("can't perform structure reference operations for %s type",
	 nm.c_str ());
  return octave_variable_reference ();
}

octave_value
octave_base_value::convert_to_str (void) const
{
  gripe_wrong_type_arg ("octave_base_value::convert_to_str ()",
			type_name ());
  return octave_value ();
}

void
octave_base_value::convert_to_row_or_column_vector (void)
{
  gripe_wrong_type_arg
    ("octave_base_value::convert_to_row_or_column_vector ()",
     type_name ());
}

void
octave_base_value::print (ostream&, bool) const
{
  gripe_wrong_type_arg ("octave_base_value::print()", type_name ());
}

void
octave_base_value::print_raw (ostream&, bool) const
{
  gripe_wrong_type_arg ("octave_base_value::print_raw()", type_name ());
}

bool
octave_base_value::print_name_tag (ostream& os, const string& name) const
{
  indent (os);
  os << name << " =";
  newline (os);
  newline (os);
  return true;
}

double
octave_base_value::double_value (bool) const
{
  double retval = octave_NaN;
  gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
  return retval;
}

Matrix
octave_base_value::matrix_value (bool) const
{
  Matrix retval;
  gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
  return retval;
}

Complex
octave_base_value::complex_value (bool) const
{
  Complex retval (octave_NaN, octave_NaN);
  gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
  return retval;
}

ComplexMatrix
octave_base_value::complex_matrix_value (bool) const
{
  ComplexMatrix retval;
  gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
			type_name ());
  return retval;
}

charMatrix
octave_base_value::char_matrix_value (bool) const
{
  charMatrix retval;
  gripe_wrong_type_arg ("octave_base_value::char_matrix_value()",
			type_name ());
  return retval;
}

string_vector
octave_base_value::all_strings (void) const
{
  string_vector retval;
  gripe_wrong_type_arg ("octave_base_value::all_strings()", type_name ());
  return retval;
}

string
octave_base_value::string_value (void) const
{
  string retval;
  gripe_wrong_type_arg ("octave_base_value::string_value()", type_name ());
  return retval;
}

Range
octave_base_value::range_value (void) const
{
  Range retval;
  gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
  return retval;
}

Octave_map
octave_base_value::map_value (void) const
{
  Octave_map retval;
  gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
  return retval;
}

octave_stream *
octave_base_value::stream_value (void) const
{
  octave_stream *retval = 0;
  gripe_wrong_type_arg ("octave_base_value::stream_value()", type_name ());
  return retval;
}

int
octave_base_value::stream_number (void) const
{
  int retval = -1;
  gripe_wrong_type_arg ("octave_base_value::stream_number()", type_name ());
  return retval;
}

octave_value_list
octave_base_value::list_value (void) const
{
  octave_value_list retval;
  gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ());
  return retval;
}

bool
octave_base_value::bool_value (void) const
{
  bool retval = false;
  gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
  return retval;
}

boolMatrix
octave_base_value::bool_matrix_value (void) const
{
  boolMatrix retval;
  gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()",
			type_name ());
  return retval;
}

octave_value
octave_base_value::not (void) const
{
  octave_value retval;
  gripe_wrong_type_arg ("octave_base_value::not()", type_name ());
  return retval;
}

octave_value
octave_base_value::uminus (void) const
{
  octave_value retval;
  gripe_wrong_type_arg ("octave_base_value::uminus()", type_name ());
  return retval;
}

octave_value
octave_base_value::transpose (void) const
{
  octave_value retval;
  gripe_wrong_type_arg ("octave_base_value::transpose()", type_name ());
  return retval;
}

octave_value
octave_base_value::hermitian (void) const
{
  octave_value retval;
  gripe_wrong_type_arg ("octave_base_value::hermitian()", type_name ());
  return retval;
}

void
octave_base_value::increment (void)
{
  gripe_wrong_type_arg ("octave_base_value::increment()", type_name ());
}

void
octave_base_value::decrement (void)
{
  gripe_wrong_type_arg ("octave_base_value::decrement()", type_name ());
}

static octave_value *
matrix_conv (const octave_value&)
{
  return new octave_matrix ();
}

static octave_value *
complex_matrix_conv (const octave_value&)
{
  return new octave_complex_matrix ();
}

static octave_value *
string_conv (const octave_value&)
{
  return new octave_char_matrix_str ();
}

void
install_base_type_conversions (void)
{
  INSTALL_ASSIGNCONV (octave_base_value, octave_scalar, octave_matrix);
  INSTALL_ASSIGNCONV (octave_base_value, octave_matrix, octave_matrix);
  INSTALL_ASSIGNCONV (octave_base_value, octave_complex, octave_complex_matrix);
  INSTALL_ASSIGNCONV (octave_base_value, octave_complex_matrix, octave_complex_matrix);
  INSTALL_ASSIGNCONV (octave_base_value, octave_range, octave_matrix);
  INSTALL_ASSIGNCONV (octave_base_value, octave_char_matrix_str, octave_char_matrix_str);

  INSTALL_WIDENOP (octave_base_value, octave_matrix, matrix_conv);
  INSTALL_WIDENOP (octave_base_value, octave_complex_matrix, complex_matrix_conv);
  INSTALL_WIDENOP (octave_base_value, octave_char_matrix_str, string_conv);
}

/*
;;; Local Variables: ***
;;; mode: C++ ***
;;; End: ***
*/