comparison src/ov.cc @ 4233:ccfdb55c8156

[project @ 2002-12-20 22:43:54 by jwe]
author jwe
date Fri, 20 Dec 2002 22:43:55 +0000
parents 23d06c9e1edd
children fc9a075d10fb
comparison
equal deleted inserted replaced
4232:b032ebd54586 4233:ccfdb55c8156
341 : rep (new octave_base_value ()) 341 : rep (new octave_base_value ())
342 { 342 {
343 rep->count = 1; 343 rep->count = 1;
344 } 344 }
345 345
346 octave_value::octave_value (int i)
347 : rep (new octave_scalar (i))
348 {
349 rep->count = 1;
350 }
351
346 octave_value::octave_value (double d) 352 octave_value::octave_value (double d)
347 : rep (new octave_scalar (d)) 353 : rep (new octave_scalar (d))
348 { 354 {
349 rep->count = 1; 355 rep->count = 1;
350 } 356 }
577 } 583 }
578 584
579 octave_value 585 octave_value
580 octave_value::next_subsref (const std::string type, 586 octave_value::next_subsref (const std::string type,
581 const std::list<octave_value_list>& idx, 587 const std::list<octave_value_list>& idx,
582 int skip) 588 size_t skip)
583 { 589 {
584 assert (skip > 0);
585
586 if (idx.size () > skip) 590 if (idx.size () > skip)
587 { 591 {
588 std::list<octave_value_list> new_idx (idx); 592 std::list<octave_value_list> new_idx (idx);
589 for (int i = 0; i < skip; i++) 593 for (size_t i = 0; i < skip; i++)
590 new_idx.erase (new_idx.begin ()); 594 new_idx.erase (new_idx.begin ());
591 return subsref (type.substr (skip), new_idx); 595 return subsref (type.substr (skip), new_idx);
592 } 596 }
593 else 597 else
594 return *this; 598 return *this;
1760 } 1764 }
1761 1765
1762 void 1766 void
1763 symbols_of_ov (void) 1767 symbols_of_ov (void)
1764 { 1768 {
1765 DEFVAR (do_fortran_indexing, 0.0, do_fortran_indexing, 1769 DEFVAR (do_fortran_indexing, false, do_fortran_indexing,
1766 "-*- texinfo -*-\n\ 1770 "-*- texinfo -*-\n\
1767 @defvr {Built-in Variable} do_fortran_indexing\n\ 1771 @defvr {Built-in Variable} do_fortran_indexing\n\
1768 If the value of @code{do_fortran_indexing} is nonzero, Octave allows \n\ 1772 If the value of @code{do_fortran_indexing} is nonzero, Octave allows \n\
1769 you to select elements of a two-dimensional matrix using a single index\n\ 1773 you to select elements of a two-dimensional matrix using a single index\n\
1770 by treating the matrix as a single vector created from the columns of\n\ 1774 by treating the matrix as a single vector created from the columns of\n\
1771 the matrix. The default value is 0. \n\ 1775 the matrix. The default value is 0. \n\
1772 @end defvr"); 1776 @end defvr");
1773 1777
1774 DEFVAR (implicit_str_to_num_ok, 0.0, implicit_str_to_num_ok, 1778 DEFVAR (implicit_str_to_num_ok, false, implicit_str_to_num_ok,
1775 "-*- texinfo -*-\n\ 1779 "-*- texinfo -*-\n\
1776 @defvr {Built-in Variable} implicit_str_to_num_ok\n\ 1780 @defvr {Built-in Variable} implicit_str_to_num_ok\n\
1777 If the value of @code{implicit_str_to_num_ok} is nonzero, implicit\n\ 1781 If the value of @code{implicit_str_to_num_ok} is nonzero, implicit\n\
1778 conversions of strings to their numeric ASCII equivalents are allowed.\n\ 1782 conversions of strings to their numeric ASCII equivalents are allowed.\n\
1779 Otherwise, an error message is printed and control is returned to the\n\ 1783 Otherwise, an error message is printed and control is returned to the\n\
1789 but a warning is printed. Otherwise, an error message is printed and\n\ 1793 but a warning is printed. Otherwise, an error message is printed and\n\
1790 control is returned to the top level. The default value is\n\ 1794 control is returned to the top level. The default value is\n\
1791 @code{\"warn\"}.\n\ 1795 @code{\"warn\"}.\n\
1792 @end defvr"); 1796 @end defvr");
1793 1797
1794 DEFVAR (prefer_column_vectors, 1.0, prefer_column_vectors, 1798 DEFVAR (prefer_column_vectors, true, prefer_column_vectors,
1795 "-*- texinfo -*-\n\ 1799 "-*- texinfo -*-\n\
1796 @defvr {Built-in Variable} prefer_column_vectors\n\ 1800 @defvr {Built-in Variable} prefer_column_vectors\n\
1797 If @code{prefer_column_vectors} is nonzero, operations like\n\ 1801 If @code{prefer_column_vectors} is nonzero, operations like\n\
1798 \n\ 1802 \n\
1799 @example\n\ 1803 @example\n\
1809 If a variable is already defined to be a vector (a matrix with a single\n\ 1813 If a variable is already defined to be a vector (a matrix with a single\n\
1810 row or column), the original orientation is respected, regardless of the\n\ 1814 row or column), the original orientation is respected, regardless of the\n\
1811 value of @code{prefer_column_vectors}.\n\ 1815 value of @code{prefer_column_vectors}.\n\
1812 @end defvr"); 1816 @end defvr");
1813 1817
1814 DEFVAR (print_answer_id_name, 1.0, print_answer_id_name, 1818 DEFVAR (print_answer_id_name, true, print_answer_id_name,
1815 "-*- texinfo -*-\n\ 1819 "-*- texinfo -*-\n\
1816 @defvr {Built-in Variable} print_answer_id_name\n\ 1820 @defvr {Built-in Variable} print_answer_id_name\n\
1817 If the value of @code{print_answer_id_name} is nonzero, variable\n\ 1821 If the value of @code{print_answer_id_name} is nonzero, variable\n\
1818 names are printed along with the result. Otherwise, only the result\n\ 1822 names are printed along with the result. Otherwise, only the result\n\
1819 values are printed. The default value is 1.\n\ 1823 values are printed. The default value is 1.\n\
1820 @end defvr"); 1824 @end defvr");
1821 1825
1822 DEFVAR (propagate_empty_matrices, 1.0, propagate_empty_matrices, 1826 DEFVAR (propagate_empty_matrices, true, propagate_empty_matrices,
1823 "-*- texinfo -*-\n\ 1827 "-*- texinfo -*-\n\
1824 @defvr {Built-in Variable} propagate_empty_matrices\n\ 1828 @defvr {Built-in Variable} propagate_empty_matrices\n\
1825 If the value of @code{propagate_empty_matrices} is nonzero,\n\ 1829 If the value of @code{propagate_empty_matrices} is nonzero,\n\
1826 functions like @code{inverse} and @code{svd} will return an empty matrix\n\ 1830 functions like @code{inverse} and @code{svd} will return an empty matrix\n\
1827 if they are given one as an argument. The default value is 1.\n\ 1831 if they are given one as an argument. The default value is 1.\n\
1828 @end defvr"); 1832 @end defvr");
1829 1833
1830 DEFVAR (resize_on_range_error, 1.0, resize_on_range_error, 1834 DEFVAR (resize_on_range_error, true, resize_on_range_error,
1831 "-*- texinfo -*-\n\ 1835 "-*- texinfo -*-\n\
1832 @defvr {Built-in Variable} resize_on_range_error\n\ 1836 @defvr {Built-in Variable} resize_on_range_error\n\
1833 If the value of @code{resize_on_range_error} is nonzero, expressions\n\ 1837 If the value of @code{resize_on_range_error} is nonzero, expressions\n\
1834 like\n\ 1838 like\n\
1835 \n\ 1839 \n\
1845 elements that have not been given a value are set to zero. If the value\n\ 1849 elements that have not been given a value are set to zero. If the value\n\
1846 of @code{resize_on_range_error} is 0, an error message is printed and\n\ 1850 of @code{resize_on_range_error} is 0, an error message is printed and\n\
1847 control is returned to the top level. The default value is 1.\n\ 1851 control is returned to the top level. The default value is 1.\n\
1848 @end defvr"); 1852 @end defvr");
1849 1853
1850 DEFVAR (silent_functions, 0.0, silent_functions, 1854 DEFVAR (silent_functions, false, silent_functions,
1851 "-*- texinfo -*-\n\ 1855 "-*- texinfo -*-\n\
1852 @defvr {Built-in Variable} silent_functions\n\ 1856 @defvr {Built-in Variable} silent_functions\n\
1853 If the value of @code{silent_functions} is nonzero, internal output\n\ 1857 If the value of @code{silent_functions} is nonzero, internal output\n\
1854 from a function is suppressed. Otherwise, the results of expressions\n\ 1858 from a function is suppressed. Otherwise, the results of expressions\n\
1855 within a function body that are not terminated with a semicolon will\n\ 1859 within a function body that are not terminated with a semicolon will\n\
1873 @defvr {Built-in Variable} struct_levels_to_print\n\ 1877 @defvr {Built-in Variable} struct_levels_to_print\n\
1874 You can tell Octave how many structure levels to display by setting the\n\ 1878 You can tell Octave how many structure levels to display by setting the\n\
1875 built-in variable @code{struct_levels_to_print}. The default value is 2.\n\ 1879 built-in variable @code{struct_levels_to_print}. The default value is 2.\n\
1876 @end defvr"); 1880 @end defvr");
1877 1881
1878 DEFVAR (warn_divide_by_zero, 1.0, warn_divide_by_zero, 1882 DEFVAR (warn_divide_by_zero, true, warn_divide_by_zero,
1879 "-*- texinfo -*-\n\ 1883 "-*- texinfo -*-\n\
1880 @defvr {Built-in Variable} warn_divide_by_zero\n\ 1884 @defvr {Built-in Variable} warn_divide_by_zero\n\
1881 If the value of @code{warn_divide_by_zero} is nonzero, a warning\n\ 1885 If the value of @code{warn_divide_by_zero} is nonzero, a warning\n\
1882 is issued when Octave encounters a division by zero. If the value is\n\ 1886 is issued when Octave encounters a division by zero. If the value is\n\
1883 0, the warning is omitted. The default value is 1.\n\ 1887 0, the warning is omitted. The default value is 1.\n\