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

Comparing ray/src/util/rad.c (file contents):
Revision 2.108 by greg, Mon Aug 12 21:01:00 2013 UTC vs.
Revision 2.111 by greg, Sun Oct 26 17:35:53 2014 UTC

# Line 24 | Line 24 | static const char      RCSid[] = "$Id$";
24    #define RENAMECMD "mv"
25    #include <sys/types.h>
26    #include <sys/wait.h>
27 +  #include <signal.h>
28   #endif
29  
30                                  /* variables (alphabetical by name) */
# Line 264 | Line 265 | userr:
265  
266   static void
267   rootname(               /* remove tail from end of fn */
268 <        register char   *rn,
269 <        register char   *fn
268 >        char    *rn,
269 >        char    *fn
270   )
271   {
272          char    *tp, *dp;
# Line 282 | Line 283 | rootname(              /* remove tail from end of fn */
283  
284   static time_t
285   checklast(                      /* check files and find most recent */
286 <        register char   *fnames
286 >        char    *fnames
287   )
288   {
289          char    thisfile[PATH_MAX];
# Line 312 | Line 313 | newfname(              /* create modified file name */
313          int     pred
314   )
315   {
316 <        register char   *cp;
317 <        register int    n;
316 >        char    *cp;
317 >        int     n;
318          int     suffix;
319  
320          n = 0; cp = orig; suffix = -1;          /* suffix position, length */
# Line 378 | Line 379 | getoctcube(            /* get octree bounding cube */
379          double  min[3], max[3];
380          char    buf[1024];
381          FILE    *fp;
382 <        register int    i;
382 >        int     i;
383  
384          if (osiz <= FTINY) {
385                  if (!nprocs && fdate(oct1name) <
# Line 587 | Line 588 | oconv(void)                            /* run oconv and mkillum if necessary *
588  
589   static char *
590   addarg(                         /* append argument and advance pointer */
591 < register char   *op,
592 < register char   *arg
591 > char    *op,
592 > char    *arg
593   )
594   {
595          while (*op)
# Line 602 | Line 603 | register char  *arg
603  
604   static void
605   oconvopts(                              /* get oconv options */
606 <        register char   *oo
606 >        char    *oo
607   )
608   {
609          /* BEWARE:  This may be called via setdefaults(), so no assumptions */
# Line 711 | Line 712 | renderopts(                    /* set rendering options */
712  
713   static void
714   lowqopts(                       /* low quality rendering options */
715 <        register char   *op,
715 >        char    *op,
716          char    *po
717   )
718   {
# Line 779 | Line 780 | lowqopts(                      /* low quality rendering options */
780  
781   static void
782   medqopts(                       /* medium quality rendering options */
783 <        register char   *op,
783 >        char    *op,
784          char    *po
785   )
786   {
# Line 857 | Line 858 | medqopts(                      /* medium quality rendering options */
858  
859   static void
860   hiqopts(                                /* high quality rendering options */
861 <        register char   *op,
861 >        char    *op,
862          char    *po
863   )
864   {
# Line 931 | Line 932 | hiqopts(                               /* high quality rendering options */
932   }
933  
934  
935 + #ifdef _WIN32
936   static void
937 + setenv(                 /* set an environment variable */
938 +        char    *vname,
939 +        char    *value
940 + )
941 + {
942 +        char    *evp;
943 +
944 +        evp = bmalloc(strlen(vname)+strlen(value)+2);
945 +        if (evp == NULL)
946 +                syserr(progname);
947 +        sprintf(evp, "%s=%s", vname, value);
948 +        if (putenv(evp) != 0) {
949 +                fprintf(stderr, "%s: out of environment space\n", progname);
950 +                quit(1);
951 +        }
952 +        if (!silent)
953 +                printf("set %s\n", evp);
954 + }
955 + #endif
956 +
957 +
958 + static void
959   xferopts(                               /* transfer options if indicated */
960          char    *ro
961   )
962   {
963          int     fd, n;
964 <        register char   *cp;
964 >        char    *cp;
965          
966          n = strlen(ro);
967          if (n < 2)
# Line 966 | Line 990 | xferopts(                              /* transfer options if indicated */
990  
991   static void
992   pfiltopts(                              /* get pfilt options */
993 <        register char   *po
993 >        char    *po
994   )
995   {
996          *po = '\0';
# Line 993 | Line 1017 | pfiltopts(                             /* get pfilt options */
1017  
1018   static int
1019   matchword(                      /* match white-delimited words */
1020 <        register char   *s1,
1021 <        register char   *s2
1020 >        char    *s1,
1021 >        char    *s2
1022   )
1023   {
1024          while (isspace(*s1)) s1++;
# Line 1008 | Line 1032 | matchword(                     /* match white-delimited words */
1032  
1033   static char *
1034   specview(                               /* get proper view spec from vs */
1035 <        register char   *vs
1035 >        char    *vs
1036   )
1037   {
1038          static char     vup[7][12] = {"-vu 0 0 -1","-vu 0 -1 0","-vu -1 0 0",
1039                          "-vu 0 0 1", "-vu 1 0 0","-vu 0 1 0","-vu 0 0 1"};
1040          static char     viewopts[128];
1041 <        register char   *cp;
1041 >        char    *cp;
1042          int     xpos, ypos, zpos, viewtype, upax;
1043 <        register int    i;
1043 >        int     i;
1044          double  cent[3], dim[3], mult, d;
1045  
1046          if (vs == NULL || *vs == '-')
# Line 1076 | Line 1100 | specview(                              /* get proper view spec from vs */
1100                          cent[i] += .5*dim[i];
1101                  }
1102                  mult = vlet(ZONE)=='E' ? 2. : .45 ;
1103 <                sprintf(cp, " -vp %.2g %.2g %.2g -vd %.2g %.2g %.2g",
1103 >                sprintf(cp, " -vp %.3g %.3g %.3g -vd %.3g %.3g %.3g",
1104                                  cent[0]+xpos*mult*dim[0],
1105                                  cent[1]+ypos*mult*dim[1],
1106                                  cent[2]+zpos*mult*dim[2],
# Line 1108 | Line 1132 | specview(                              /* get proper view spec from vs */
1132                          break;
1133                  case VT_PAR:
1134                          d = sqrt(dim[0]*dim[0]+dim[1]*dim[1]+dim[2]*dim[2]);
1135 <                        sprintf(cp, " -vh %.2g -vv %.2g", d, d);
1135 >                        sprintf(cp, " -vh %.3g -vv %.3g", d, d);
1136                          cp += strlen(cp);
1137                          break;
1138                  case VT_ANG:
# Line 1148 | Line 1172 | getview(                               /* get view n, or NULL if none */
1172          char    *vn             /* returned view name */
1173   )
1174   {
1175 <        register char   *mv;
1175 >        char    *mv;
1176  
1177          if (viewselect != NULL) {               /* command-line selected */
1178                  if (n)                          /* only do one */
# Line 1180 | Line 1204 | numview:
1204          mv = nvalue(VIEWS, n);          /* use view n */
1205          if ((vn != NULL) & (mv != NULL))
1206                  if (*mv != '-') {
1207 <                        register char   *mv2 = mv;
1207 >                        char    *mv2 = mv;
1208                          while (*mv2 && !isspace(*mv2))
1209                                  *vn++ = *mv2++;
1210                          *vn = '\0';
# Line 1193 | Line 1217 | numview:
1217  
1218   static int
1219   myprintview(                    /* print out selected view */
1220 <        register char   *vopts,
1220 >        char    *vopts,
1221          FILE    *fp
1222   )
1223   {
1224          VIEW    vwr;
1225          char    buf[128];
1226 <        register char   *cp;
1226 >        char    *cp;
1227   #ifdef _WIN32
1228   /* XXX Should we allow something like this for all platforms? */
1229   /* XXX Or is it still required at all? */
# Line 1679 | Line 1703 | finish_process(void)                   /* exit a child process */
1703                  return;                 /* in parent -- noop */
1704          exit(0);
1705   }
1682
1683 #ifdef _WIN32
1684 setenv(vname, value)            /* set an environment variable */
1685 char    *vname, *value;
1686 {
1687        register char   *evp;
1688
1689        evp = bmalloc(strlen(vname)+strlen(value)+2);
1690        if (evp == NULL)
1691                syserr(progname);
1692        sprintf(evp, "%s=%s", vname, value);
1693        if (putenv(evp) != 0) {
1694                fprintf(stderr, "%s: out of environment space\n", progname);
1695                quit(1);
1696        }
1697        if (!silent)
1698                printf("set %s\n", evp);
1699 }
1700 #endif
1706  
1707  
1708   static void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines