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

Comparing ray/src/util/eplus_idf.c (file contents):
Revision 2.4 by greg, Sun Feb 9 05:49:21 2014 UTC vs.
Revision 2.7 by greg, Tue Feb 11 23:30:11 2014 UTC

# Line 44 | Line 44 | idf_newparam(IDF_LOADED *idf, const char *pname, const
44          if (pnew == NULL)
45                  return(NULL);
46          strcpy(pnew->rem, comm);
47 +        pnew->nfield = 0;
48          pnew->flist = NULL;
49          pnew->pname = pent->key;        /* add to table */
50          pnew->pnext = (IDF_PARAMETER *)pent->data;
# Line 76 | Line 77 | idf_addfield(IDF_PARAMETER *param, const char *fval, c
77          if (fnew == NULL)
78                  return(0);
79          fnew->next = NULL;
80 <        cp = fnew->arg;                 /* copy argument and comments */
80 >        cp = fnew->val;                 /* copy value and comments */
81          while ((*cp++ = *fval++))
82                  ;
83          fnew->rem = cp;
# Line 94 | Line 95 | idf_addfield(IDF_PARAMETER *param, const char *fval, c
95                  param->flist = fnew;
96          else
97                  flast->next = fnew;
98 +        param->nfield++;
99          return(fnum);
100   }
101  
# Line 161 | Line 163 | idf_movparam(IDF_LOADED *idf, IDF_PARAMETER *param, ID
163  
164          if ((idf == NULL) | (param == NULL))
165                  return(0);
166 +                                        /* quick check if already there */
167 +        if (param == (prev==NULL ? idf->pfirst : prev->dnext))
168 +                return(1);
169                                          /* find in IDF list, first*/
170          for (plast = NULL, pptr = idf->pfirst;
171                                  pptr != param; plast = pptr, pptr = pptr->dnext)
172                  if (pptr == NULL)
173                          return(0);
174 <        if (plast == NULL) {
170 <                if (prev == NULL)
171 <                        return(1);      /* already in place */
174 >        if (plast == NULL)
175                  idf->pfirst = param->dnext;
176 <        } else {
174 <                if (prev == plast)
175 <                        return(1);      /* already in place */
176 >        else
177                  plast->dnext = param->dnext;
177        }
178          if (idf->plast == param)
179                  idf->plast = plast;
180          if (prev == NULL) {             /* means they want it at beginning */
# Line 365 | Line 365 | idf_writeparam(IDF_PARAMETER *param, FILE *fp, int inc
365                  fputs(param->rem, fp);
366          for (fptr = param->flist; fptr != NULL; fptr = fptr->next) {
367                  if (!incl_comm)
368 <                        fputs("\n\t", fp);
369 <                fputs(fptr->arg, fp);
368 >                        fputs("\n    ", fp);
369 >                fputs(fptr->val, fp);
370                  fputc((fptr->next==NULL ? ';' : ','), fp);
371                  if (incl_comm)
372                          fputs(fptr->rem, fp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines