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

Comparing ray/src/gen/xform.c (file contents):
Revision 2.45 by greg, Wed Jun 22 17:05:00 2011 UTC vs.
Revision 2.48 by greg, Wed Jul 9 23:14:58 2014 UTC

# Line 19 | Line 19 | static const char RCSid[] = "$Id$";
19   #include  "object.h"
20   #include  "otypes.h"
21  
22 + #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
23 + #undef getc
24 + #define getc    getc_unlocked
25 + #endif
26 +
27   int  xac;                               /* global xform argument count */
28   char  **xav;                            /* global xform argument pointer */
29   int  xfa;                               /* start of xf arguments */
# Line 98 | Line 103 | main(          /* get transform options and transform file */
103                                  if (idprefix == NULL)
104                                          idprefix = argv[a];
105                                  else {
106 <                                        register char   *newp;
106 >                                        char    *newp;
107                                          newp = (char *)malloc(strlen(idprefix)+
108                                                          strlen(argv[a])+2);
109                                          if (newp == NULL)
# Line 106 | Line 111 | main(          /* get transform options and transform file */
111                                          sprintf(newp, "%s.%s",
112                                                          idprefix, argv[a]);
113                                          if (mal_prefix++)
114 <                                                free((void *)idprefix);
114 >                                                free(idprefix);
115                                          idprefix = newp;
116                                  }
117                                  continue;
# Line 134 | Line 139 | main(          /* get transform options and transform file */
139  
140          a += xf(&tot, argc-a, argv+a);
141  
142 <        if ( (reverse = tot.sca < 0.0) )
142 >        if ( (reverse = (tot.sca < 0.0)) )
143                  tot.sca = -tot.sca;
144          if (invert)
145                  reverse = !reverse;
# Line 167 | Line 172 | main(          /* get transform options and transform file */
172                  }
173  
174          if (mal_prefix)
175 <                free((void *)idprefix);
175 >                free(idprefix);
176          return(0);
177   }
178  
# Line 184 | Line 189 | doargf(                        /* take argument list from file */
189          char  argbuf[2048];
190          char  *newid, newidbuf[128];
191          char  *oldid;
192 <        register char   *cp;
192 >        char    *cp;
193          FILE    *argfp;
194          int  n, i, k, newac, err;
195          
# Line 284 | Line 289 | doargf(                        /* take argument list from file */
289                          sprintf(newid, "%s.%d", oldid, k);
290                  err |= main(newac, avp);
291                  if (newid != newidbuf)
292 <                        free((void *)newid);
292 >                        free(newid);
293                  k++;
294          }
295          fclose(argfp);
# Line 343 | Line 348 | doarray(                       /* make array */
348   void
349   xform(                  /* transform stream by tot.xfm */
350          char  *name,
351 <        register FILE  *fin
351 >        FILE  *fin
352   )
353   {
354          int  nobjs = 0;
355 <        register int  c;
355 >        int  c;
356  
357          while ((c = getc(fin)) != EOF) {
358                  if (isspace(c))                         /* blank */
# Line 456 | Line 461 | o_default(                     /* pass on arguments unchanged */
461          FILE  *fin
462   )
463   {
464 <        register int  i;
464 >        int  i;
465          FUNARGS  fa;
466  
467          if (readfargs(&fa, fin) != 1)
# Line 492 | Line 497 | addxform(                      /* add xf arguments to strings */
497          FILE  *fin
498   )
499   {
500 <        register int  i;
500 >        int  i;
501          int  resetarr = 0;
502          FUNARGS  fa;
503  
# Line 605 | Line 610 | m_mist(                /* transform arguments for mist */
610          else
611                  for (i = 0; i < fa.nsargs; i++) {
612                          char    sname[256], *sp;
613 <                        register char   *cp1, *cp2 = sname;
613 >                        char    *cp1, *cp2 = sname;
614                                                          /* add idprefix */
615                          for (sp = fa.sarg[i]; *sp; sp = cp1) {
616                                  for (cp1 = idprefix; *cp1; )
# Line 775 | Line 780 | o_face(                        /* transform face arguments */
780   )
781   {
782          FVECT  p;
783 <        register int  i;
783 >        int  i;
784          FUNARGS  fa;
785  
786          if (readfargs(&fa, fin) != 1)
# Line 889 | Line 894 | o_ring(                        /* transform ring arguments */
894   void
895   initotypes(void)                        /* initialize ofun[] array */
896   {
897 <        register int  i;
897 >        int  i;
898  
899          if (ofun[OBJ_SOURCE].funp == o_source)
900                  return;                 /* done already */
# Line 967 | Line 972 | openmain(              /* open input, changing directory for file
972          static char  origdir[PATH_MAX];
973          static char  curfn[PATH_MAX];
974          static int  diffdir;
975 <        register char  *fpath;
975 >        char  *fpath;
976  
977          if (iname == NULL) {                    /* standard input */
978                  if (mainfp == NULL) {
979 <                        register int  c;
979 >                        int  c;
980                          strcpy(mainfn, "standard input");
981                          if (nrept <= 1) {
982                                  mainfp = stdin;
# Line 1015 | Line 1020 | openmain(              /* open input, changing directory for file
1020                                                  /* record path name */
1021          strcpy(mainfn, fpath);
1022          if (expand) {                           /* change to local directory */
1023 <                register char  *cp = fpath + strlen(fpath);     /* get dir. */
1023 >                char  *cp = fpath + strlen(fpath);      /* get dir. */
1024                  while (cp > fpath) {
1025                          cp--;
1026                          if (ISDIRSEP(*cp)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines