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

Comparing ray/src/gen/genworm.c (file contents):
Revision 2.5 by schorsch, Mon Jul 21 22:30:18 2003 UTC vs.
Revision 2.9 by greg, Fri Jan 12 00:50:17 2018 UTC

# Line 11 | Line 11 | static const char      RCSid[] = "$Id$";
11   *      9/24/87
12   */
13  
14 + #include  <stdlib.h>
15   #include  <stdio.h>
16   #include  <math.h>
17 + #include  <string.h>
18 +
19 + #include  "calcomp.h"
20 + #include  "resolu.h"
21 + #include  "rterror.h"
22   #include  "fvect.h"
23  
24   #define  XNAME          "X`SYS`"                /* x function name */
# Line 25 | Line 31 | static const char      RCSid[] = "$Id$";
31   #define  max(a,b)       ((a) > (b) ? (a) : (b))
32  
33  
34 < double  funvalue(), l_hermite(), l_bezier(), l_bspline(), argument();
35 < void  quit();
34 > /* XXX redundant, move to library */
35 > double  l_hermite(char *), l_bezier(char *), l_bspline(char *);
36  
37  
38 + int
39   main(argc, argv)
40   int  argc;
41   char  *argv[];
42   {
36        extern long     eclock;
43          char  stmp[256];
44 <        double  t, f, lastr, r;
44 >        double  t, f, lastr = 0, r;
45          FVECT  lastp, p;
46          int  i, nseg;
47  
48 +        esupport |= E_VARIABLE|E_FUNCTION|E_RCONST;
49 +        esupport &= ~(E_OUTCHAN|E_INCHAN);
50          varset("PI", ':', PI);
51          funset("hermite", 5, ':', l_hermite);
52          funset("bezier", 5, ':', l_bezier);
# Line 67 | Line 75 | char  *argv[];
75          if (nseg <= 0)
76                  goto userror;
77  
78 <        printhead(argc, argv);
78 >        fputs("# ", stdout);
79 >        printargs(argc, argv, stdout);
80          eclock = 0;
81  
82          for (i = 0; i <= nseg; i++) {
# Line 110 | Line 119 | char  *argv[];
119                  VCOPY(lastp, p);
120                  lastr = r;
121          }
122 <        quit(0);
122 >        return 0;
123  
124   userror:
125          fprintf(stderr,
126   "Usage: %s material name x(t) y(t) z(t) r(t) nseg [-e expr] [-f file]\n",
127                          argv[0]);
128 <        quit(1);
128 >        return 1;
129   }
130  
131  
123 void
124 eputs(msg)
125 char  *msg;
126 {
127        fputs(msg, stderr);
128 }
129
130
131 void
132 wputs(msg)
133 char  *msg;
134 {
135        eputs(msg);
136 }
137
138
139 void
140 quit(code)
141 int  code;
142 {
143        exit(code);
144 }
145
146
147 printhead(ac, av)               /* print command header */
148 register int  ac;
149 register char  **av;
150 {
151        putchar('#');
152        while (ac--) {
153                putchar(' ');
154                fputs(*av++, stdout);
155        }
156        putchar('\n');
157 }
158
159
132   double
133 < l_hermite()                    
133 > l_hermite(char *nm)
134   {
135          double  t;
136          
# Line 171 | Line 143 | l_hermite()                    
143  
144  
145   double
146 < l_bezier()
146 > l_bezier(char *nm)
147   {
148          double  t;
149  
# Line 184 | Line 156 | l_bezier()
156  
157  
158   double
159 < l_bspline()
159 > l_bspline(char *nm)
160   {
161          double  t;
162  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines