# HG changeset patch # User John W. Eaton # Date 1204075798 18000 # Node ID 4dda6fbc8ba6bece05c5bb83b8979eaacadc9401 # Parent bda16af4fd2f5a0af5de734e17834f2d213ecb2c oct-rand.cc: fix typo diff -r bda16af4fd2f -r 4dda6fbc8ba6 liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Feb 26 18:45:57 2008 -0500 +++ b/liboctave/ChangeLog Tue Feb 26 20:29:58 2008 -0500 @@ -1,5 +1,9 @@ 2008-02-26 John W. Eaton + * oct-rand.cc (get_dist_id): Fix typo. + (get_dist_id, octave_rand::distribution, octave_rand::scalar, + fill_rand): Improve error messages. + * oct-rand.cc (unknown_dist): New dist type. (uniform_dist, normal_dist, expon_dist, poisson_dist, gamma_dist): Use static const int instead of #define. diff -r bda16af4fd2f -r 4dda6fbc8ba6 liboctave/oct-rand.cc --- a/liboctave/oct-rand.cc Tue Feb 26 18:45:57 2008 -0500 +++ b/liboctave/oct-rand.cc Tue Feb 26 20:29:58 2008 -0500 @@ -197,10 +197,11 @@ retval = expon_dist; else if (d == "poisson" || d == "randp") retval = poisson_dist; - else if (d == "gamma" || d == "rangd") + else if (d == "gamma" || d == "randg") retval = gamma_dist; else - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution `%s'", d.c_str ()); return retval; } @@ -349,7 +350,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } @@ -359,7 +361,9 @@ void octave_rand::distribution (const std::string& d) { - switch (get_dist_id (d)) + int id = get_dist_id (d); + + switch (id) { case uniform_dist: octave_rand::uniform_distribution (); @@ -382,7 +386,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", id); break; } } @@ -480,7 +485,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } } @@ -509,7 +515,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; } @@ -613,7 +620,8 @@ break; default: - (*current_liboctave_error_handler) ("rand: invalid distribution"); + (*current_liboctave_error_handler) + ("rand: invalid distribution ID = %d", current_distribution); break; }