ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rcomb.c
(Generate patch)

Comparing ray/src/util/rcomb.c (file contents):
Revision 2.23 by greg, Fri Jun 7 03:55:59 2024 UTC vs.
Revision 2.28 by greg, Fri Mar 28 00:06:36 2025 UTC

# Line 21 | Line 21 | static const char RCSid[] = "$Id$";
21   #define M_PI    3.14159265358979323846
22   #endif
23  
24 + #ifndef MAXCOMP
25   #define MAXCOMP         MAXCSAMP        /* #components we support */
26 + #endif
27  
28   /* Unary matrix operation(s) */
29   typedef struct {
# Line 174 | Line 176 | xyzrow(ROPMAT *rop, int r, int p)
176  
177   /* Use the spectral sensitivity function to compute matrix coefficients */
178   void
179 < sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, int ncs, const float wlpt[4]))
179 > sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4]))
180   {
181          const int       nc = rop->imx.ncomp;
182          int             i;
# Line 488 | Line 490 | initialize(RMATRIX *imp)
490                  restype = mop[i].rmp->dtype;
491                  if (!imp->dtype || (restype = rmx_newtype(restype, imp->dtype)) > 0)
492                          imp->dtype = restype;
493 <                else
493 >                else if (!nowarn)
494                          fprintf(stderr, "%s: warning - data type mismatch\n",
495                                          mop[i].inspec);
496                  if (!i) {
# Line 552 | Line 554 | spawned_children(int np)
554  
555   #if defined(_WIN32) || defined(_WIN64)
556          if (np > 1) {
557 <                fputs("Warning: only one process under Windows\n", stderr);
557 >                if (!nowarn)
558 >                        fputs("Warning: only one process under Windows\n", stderr);
559                  np = 1;
560          } else
561   #endif
# Line 672 | Line 675 | parent_loop(void)
675                  if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) {
676                          if (cur_row > in_nrows) /* unknown #input rows? */
677                                  break;
678 <                        fprintf(stderr, "%s: parent_loop() load error at row %d\n",
678 >                        fprintf(stderr, "%s: load error at row %d\n",
679                                          mop[i].inspec, cur_row);
680                          return(0);
681                  }
# Line 681 | Line 684 | parent_loop(void)
684              for (i = 0; i < nmats; i++)
685                  if (writebuf(wfd, mop[i].imx.mtx, rmx_array_size(&mop[i].imx))
686                                          != rmx_array_size(&mop[i].imx)) {
687 <                        fprintf(stderr, "%s: parent_loop() write error at row %d\n",
687 >                        fprintf(stderr, "%s: write error at row %d\n",
688                                          mop[i].inspec, cur_row);
689                          return(0);
690                  }
# Line 689 | Line 692 | parent_loop(void)
692          i = close_processes(cproc, nchildren);  /* collect family */
693          free(cproc); cproc = NULL; nchildren = 0;
694          if (i < 0) {
695 <                fputs("Warning: lost child in parent_loop()\n", stderr);
695 >                if (!nowarn)
696 >                        fputs("Warning: lost child process\n", stderr);
697                  return(1);
698          }
699          if (i > 0) {
# Line 735 | Line 739 | combine_input(void)
739                  if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) {
740                          if (cur_row > in_nrows) /* unknown #input rows? */
741                                  break;
742 <                        fprintf(stderr, "%s: combine_input() load error at row %d\n",
742 >                        fprintf(stderr, "%s: load error at row %d\n",
743                                          mop[i].inspec, cur_row);
744                          return(0);
745                  }
# Line 783 | Line 787 | combine_input(void)
787              if (!rmx_write_data(res->rmp->mtx, res->rmp->ncomp,
788                                  res->rmp->ncols, res->rmp->dtype, stdout) ||
789                                   (inchild >= 0 && fflush(stdout) == EOF)) {
790 <                fprintf(stderr, "Conversion/write error at row %d in combine_input()\n",
790 >                fprintf(stderr, "Conversion/write error at row %d\n",
791                                  cur_row);
792                  return(0);
793              }
794          }
795          return(inchild >= 0 || fflush(stdout) != EOF);
796   multerror:
797 <        fputs("Unexpected matrix multiply error in combine_input()\n", stderr);
797 >        fputs("Unexpected matrix multiply error\n", stderr);
798          return(0);
799   }
800  
# Line 819 | Line 823 | output_loop(void)
823                  if (!rv)                                /* out of rows? */
824                          break;
825                  if (rv != row_size) {
826 <                        fputs("Read error in output_loop()\n", stderr);
826 >                        fputs("Read error\n", stderr);
827                          return(0);
828                  }                                       /* do final conversion */
829                  if (!rmx_write_data(mop[nmats].rmp->mtx, mop[nmats].rmp->ncomp,
830                                  mop[nmats].rmp->ncols, mop[nmats].rmp->dtype, stdout)) {
831 <                        fputs("Conversion/write error in output_loop()\n", stderr);
831 >                        fputs("Conversion/write error\n", stderr);
832                          return(0);
833                  }
834                  cur_child++;
# Line 850 | Line 854 | resize_inparr(int n2alloc)
854  
855          if (n2alloc == nall)
856                  return;
857 <        for (i = nall; i > n2alloc; i--) {
857 >        for (i = nall; i-- > n2alloc; ) {
858                  rmx_reset(&mop[i].imx);
859                  if (mop[i].rmp != &mop[i].imx)
860                          rmx_free(mop[i].rmp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines