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.29 by greg, Fri Apr 4 18:06:48 2025 UTC

# Line 21 | Line 21 | static const char RCSid[] = "$Id$";
21   #define M_PI    3.14159265358979323846
22   #endif
23  
24 #define MAXCOMP         MAXCSAMP        /* #components we support */
25
24   /* Unary matrix operation(s) */
25   typedef struct {
26          double          cmat[MAXCOMP*MAXCOMP];  /* component transformation */
# Line 174 | Line 172 | xyzrow(ROPMAT *rop, int r, int p)
172  
173   /* Use the spectral sensitivity function to compute matrix coefficients */
174   void
175 < sensrow(ROPMAT *rop, int r, double (*sf)(SCOLOR sc, int ncs, const float wlpt[4]))
175 > sensrow(ROPMAT *rop, int r, double (*sf)(const SCOLOR sc, int ncs, const float wlpt[4]))
176   {
177          const int       nc = rop->imx.ncomp;
178          int             i;
# Line 488 | Line 486 | initialize(RMATRIX *imp)
486                  restype = mop[i].rmp->dtype;
487                  if (!imp->dtype || (restype = rmx_newtype(restype, imp->dtype)) > 0)
488                          imp->dtype = restype;
489 <                else
489 >                else if (!nowarn)
490                          fprintf(stderr, "%s: warning - data type mismatch\n",
491                                          mop[i].inspec);
492                  if (!i) {
# Line 552 | Line 550 | spawned_children(int np)
550  
551   #if defined(_WIN32) || defined(_WIN64)
552          if (np > 1) {
553 <                fputs("Warning: only one process under Windows\n", stderr);
553 >                if (!nowarn)
554 >                        fputs("Warning: only one process under Windows\n", stderr);
555                  np = 1;
556          } else
557   #endif
# Line 672 | Line 671 | parent_loop(void)
671                  if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) {
672                          if (cur_row > in_nrows) /* unknown #input rows? */
673                                  break;
674 <                        fprintf(stderr, "%s: parent_loop() load error at row %d\n",
674 >                        fprintf(stderr, "%s: load error at row %d\n",
675                                          mop[i].inspec, cur_row);
676                          return(0);
677                  }
# Line 681 | Line 680 | parent_loop(void)
680              for (i = 0; i < nmats; i++)
681                  if (writebuf(wfd, mop[i].imx.mtx, rmx_array_size(&mop[i].imx))
682                                          != rmx_array_size(&mop[i].imx)) {
683 <                        fprintf(stderr, "%s: parent_loop() write error at row %d\n",
683 >                        fprintf(stderr, "%s: write error at row %d\n",
684                                          mop[i].inspec, cur_row);
685                          return(0);
686                  }
# Line 689 | Line 688 | parent_loop(void)
688          i = close_processes(cproc, nchildren);  /* collect family */
689          free(cproc); cproc = NULL; nchildren = 0;
690          if (i < 0) {
691 <                fputs("Warning: lost child in parent_loop()\n", stderr);
691 >                if (!nowarn)
692 >                        fputs("Warning: lost child process\n", stderr);
693                  return(1);
694          }
695          if (i > 0) {
# Line 735 | Line 735 | combine_input(void)
735                  if (!rmx_load_row(mop[i].imx.mtx, &mop[i].imx, mop[i].infp)) {
736                          if (cur_row > in_nrows) /* unknown #input rows? */
737                                  break;
738 <                        fprintf(stderr, "%s: combine_input() load error at row %d\n",
738 >                        fprintf(stderr, "%s: load error at row %d\n",
739                                          mop[i].inspec, cur_row);
740                          return(0);
741                  }
# Line 783 | Line 783 | combine_input(void)
783              if (!rmx_write_data(res->rmp->mtx, res->rmp->ncomp,
784                                  res->rmp->ncols, res->rmp->dtype, stdout) ||
785                                   (inchild >= 0 && fflush(stdout) == EOF)) {
786 <                fprintf(stderr, "Conversion/write error at row %d in combine_input()\n",
786 >                fprintf(stderr, "Conversion/write error at row %d\n",
787                                  cur_row);
788                  return(0);
789              }
790          }
791          return(inchild >= 0 || fflush(stdout) != EOF);
792   multerror:
793 <        fputs("Unexpected matrix multiply error in combine_input()\n", stderr);
793 >        fputs("Unexpected matrix multiply error\n", stderr);
794          return(0);
795   }
796  
# Line 819 | Line 819 | output_loop(void)
819                  if (!rv)                                /* out of rows? */
820                          break;
821                  if (rv != row_size) {
822 <                        fputs("Read error in output_loop()\n", stderr);
822 >                        fputs("Read error\n", stderr);
823                          return(0);
824                  }                                       /* do final conversion */
825                  if (!rmx_write_data(mop[nmats].rmp->mtx, mop[nmats].rmp->ncomp,
826                                  mop[nmats].rmp->ncols, mop[nmats].rmp->dtype, stdout)) {
827 <                        fputs("Conversion/write error in output_loop()\n", stderr);
827 >                        fputs("Conversion/write error\n", stderr);
828                          return(0);
829                  }
830                  cur_child++;
# Line 850 | Line 850 | resize_inparr(int n2alloc)
850  
851          if (n2alloc == nall)
852                  return;
853 <        for (i = nall; i > n2alloc; i--) {
853 >        for (i = nall; i-- > n2alloc; ) {
854                  rmx_reset(&mop[i].imx);
855                  if (mop[i].rmp != &mop[i].imx)
856                          rmx_free(mop[i].rmp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines