Allow sics read runction to work OK

This commit is contained in:
cvs
2000-11-15 14:48:55 +00:00
parent b8bbb356ae
commit f9a31d2065

View File

@ -1,4 +1,4 @@
#define IDENT "1A02" #define IDENT "1A03"
/* /*
** +--------------------------------------------------------------+ ** +--------------------------------------------------------------+
** | Paul Scherrer Institute | ** | Paul Scherrer Institute |
@ -1603,8 +1603,9 @@
** SQHM_CONFIG rejects anything else. So, start by checking arguments. ** SQHM_CONFIG rejects anything else. So, start by checking arguments.
*/ */
maxbins = (FS_hi_cntr - FS_lo_cntr + 1) * (FS_hi_bin - FS_lo_bin + 1); maxbins = (FS_hi_cntr - FS_lo_cntr + 1) * (FS_hi_bin - FS_lo_bin + 1);
/***************************************************************/
if (hist_no == -1) { /***************************************************************/
if ((hist_no == -1) || (hist_no == 0)) {
/* Regard the histograms as 1 long array */ /* Regard the histograms as 1 long array */
if ((first == -1) && (nbins == -1)) { if ((first == -1) && (nbins == -1)) {
/* The user just wants to read everything */ /* The user just wants to read everything */
@ -1614,13 +1615,13 @@
/* The user wants a part of the histogram data */ /* The user wants a part of the histogram data */
if (first >= maxbins) { if (first >= maxbins) {
if (FS_dbg_lev0) printf ( if (FS_dbg_lev0) printf (
"\n%s -- SQHM_READ: bad first_bin!\n", FS_name[index]); "\n%s -- SQHM_READ: bad first_bin %d!\n", FS_name[index], first);
is = FS_rply_status_setup_and_send (rw_skt, rply_bf, KER__BAD_VALUE, is = FS_rply_status_setup_and_send (rw_skt, rply_bf, KER__BAD_VALUE,
0, "\"first_bin\" too big", &FS_bytes_put); 0, "\"first_bin\" too big", &FS_bytes_put);
return is; return is;
}else if ((nbins > maxbins) || ((first + nbins) > maxbins)) { }else if ((nbins > maxbins) || ((first + nbins) > maxbins)) {
if (FS_dbg_lev0) printf ( if (FS_dbg_lev0) printf (
"\n%s -- SQHM_READ: bad n_bins!\n", FS_name[index]); "\n%s -- SQHM_READ: bad n_bins %d!\n", FS_name[index], nbins);
is = FS_rply_status_setup_and_send (rw_skt, rply_bf, KER__BAD_VALUE, is = FS_rply_status_setup_and_send (rw_skt, rply_bf, KER__BAD_VALUE,
0, "\"n_bins\" too big", &FS_bytes_put); 0, "\"n_bins\" too big", &FS_bytes_put);
return is; return is;
@ -1653,6 +1654,7 @@
my_fstbin = (hist_no - FS_lo_cntr) * (FS_hi_bin - FS_lo_bin + 1) + first; my_fstbin = (hist_no - FS_lo_cntr) * (FS_hi_bin - FS_lo_bin + 1) + first;
my_nbins = nbins; my_nbins = nbins;
} }
/***************************************************************/
/* /*
** The args are OK. ** The args are OK.
** Reserve some space for buffering the histogram data. ** Reserve some space for buffering the histogram data.