comparison src/DLD-FUNCTIONS/hex2num.cc @ 11553:01f703952eff

Improve docstrings for functions in DLD-FUNCTIONS directory. Use same variable names in error() strings and in documentation.
author Rik <octave@nomad.inbox5.com>
date Sun, 16 Jan 2011 22:13:23 -0800
parents fd0a3ac60b0e
children 12df7854fa7c
comparison
equal deleted inserted replaced
11552:6b6e9051ecb8 11553:01f703952eff
33 #include "utils.h" 33 #include "utils.h"
34 34
35 DEFUN_DLD (hex2num, args, , 35 DEFUN_DLD (hex2num, args, ,
36 "-*- texinfo -*-\n\ 36 "-*- texinfo -*-\n\
37 @deftypefn {Loadable Function} {@var{n} =} hex2num (@var{s})\n\ 37 @deftypefn {Loadable Function} {@var{n} =} hex2num (@var{s})\n\
38 Typecast the 16 character hexadecimal character matrix to an IEEE 754\n\ 38 Typecast the 16 character hexadecimal character string to an IEEE 754\n\
39 double precision number. If fewer than 16 characters are given the\n\ 39 double precision number. If fewer than 16 characters are given the\n\
40 strings are right padded with '0' characters.\n\ 40 strings are right padded with '0' characters.\n\
41 \n\ 41 \n\
42 Given a string matrix, @code{hex2num} treats each row as a separate\n\ 42 Given a string matrix, @code{hex2num} treats each row as a separate\n\
43 number.\n\ 43 number.\n\
59 else 59 else
60 { 60 {
61 const charMatrix cmat = args(0).char_matrix_value (); 61 const charMatrix cmat = args(0).char_matrix_value ();
62 62
63 if (cmat.columns () > 16) 63 if (cmat.columns () > 16)
64 error ("hex2num: expecting no more than a 16 character string"); 64 error ("hex2num: S must be no more than 16 characters");
65 else if (! error_state) 65 else if (! error_state)
66 { 66 {
67 octave_idx_type nr = cmat.rows (); 67 octave_idx_type nr = cmat.rows ();
68 octave_idx_type nc = cmat.columns (); 68 octave_idx_type nc = cmat.columns ();
69 ColumnVector m (nr); 69 ColumnVector m (nr);
90 else 90 else
91 num.ival += static_cast<uint64_t> (ch - '0'); 91 num.ival += static_cast<uint64_t> (ch - '0');
92 } 92 }
93 else 93 else
94 { 94 {
95 error ("hex2num: illegal character found in string"); 95 error ("hex2num: illegal character found in string S");
96 break; 96 break;
97 } 97 }
98 } 98 }
99 99
100 if (error_state) 100 if (error_state)