Skip to content

Commit

Permalink
fix(genbox, genprism, gensky): normalizing headers for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregungory committed Jul 25, 2020
1 parent 777c8c1 commit 36c9077
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 100 deletions.
8 changes: 4 additions & 4 deletions src/gen/Rmakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCSid: $Id: Rmakefile,v 2.36 2018/08/31 16:01:45 greg Exp $
# RCSid: $Id: Rmakefile,v 2.37 2020/07/25 19:18:01 greg Exp $
#
# Makefile for object generation programs
#
Expand Down Expand Up @@ -35,13 +35,13 @@ genbeads: genbeads.o hermite3.o
$(CC) $(CFLAGS) -o genbeads genbeads.o hermite3.o $(MLIB)

genbox: genbox.o
$(CC) $(CFLAGS) -o genbox genbox.o
$(CC) $(CFLAGS) -o genbox genbox.o -lrtrad

genmarble: genmarble.o ../common/random.h
$(CC) $(CFLAGS) -o genmarble genmarble.o $(MLIB)

gensky: gensky.o sun.o
$(CC) $(CFLAGS) -o gensky gensky.o sun.o $(MLIB)
$(CC) $(CFLAGS) -o gensky gensky.o sun.o -lrtrad $(MLIB)

gendaylit: gendaylit.o sun.o
$(CC) $(CFLAGS) -o gendaylit gendaylit.o sun.o -lrtrad $(MLIB)
Expand All @@ -53,7 +53,7 @@ genblinds: genblinds.o
$(CC) $(CFLAGS) -o genblinds genblinds.o $(MLIB)

genprism: genprism.o
$(CC) $(CFLAGS) -o genprism genprism.o $(MLIB)
$(CC) $(CFLAGS) -o genprism genprism.o -lrtrad $(MLIB)

xform: xform.o
$(CC) $(CFLAGS) -o xform xform.o -lrtrad $(MLIB)
Expand Down
48 changes: 13 additions & 35 deletions src/gen/genbox.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#ifndef lint
static const char RCSid[] = "$Id: genbox.c,v 2.7 2003/11/16 10:29:38 schorsch Exp $";
static const char RCSid[] = "$Id: genbox.c,v 2.8 2020/07/25 19:18:01 greg Exp $";
#endif
/*
* genbox.c - generate a parallelepiped.
*
* 1/8/86
*/

#include <stdio.h>

#include <stdlib.h>

#include "rtio.h"
#include <stdlib.h>
#include <math.h>


Expand All @@ -31,8 +29,7 @@ int reverse = 0; /* boolean true for reversed normals */


static void
vertex(v)
register int v;
vertex(int v)
{
register int i;

Expand All @@ -48,8 +45,7 @@ register int v;


static void
side(a, b, c, d) /* generate a rectangular face */
int a, b, c, d;
side(int a, int b, int c, int d) /* generate a rectangular face */
{
printf("\n%s polygon %s.%c%c%c%c\n", cmtype, cname,
let[a], let[b], let[c], let[d]);
Expand All @@ -69,8 +65,7 @@ int a, b, c, d;


static void
corner(a, b, c) /* generate a triangular face */
int a, b, c;
corner(int a, int b, int c) /* generate a triangular face */
{
printf("\n%s polygon %s.%c%c%c\n", cmtype, cname,
let[a], let[b], let[c]);
Expand All @@ -88,8 +83,7 @@ int a, b, c;


static void
cylinder(v0, v1) /* generate a cylinder */
int v0, v1;
cylinder(int v0, int v1) /* generate a cylinder */
{
printf("\n%s cylinder %s.%c%c\n", cmtype, cname, v0+'0', v1+'0');
printf("0\n0\n7\n");
Expand All @@ -100,8 +94,7 @@ int v0, v1;


static void
sphere(v0) /* generate a sphere */
int v0;
sphere(int v0) /* generate a sphere */
{
printf("\n%s sphere %s.%c\n", cmtype, cname, v0+'0');
printf("0\n0\n4\n");
Expand All @@ -110,24 +103,8 @@ int v0;
}


static void
printhead(ac, av) /* print command header */
register int ac;
register char **av;
{
putchar('#');
while (ac--) {
putchar(' ');
fputs(*av++, stdout);
}
putchar('\n');
}


int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
int i;

Expand Down Expand Up @@ -158,7 +135,8 @@ char **argv;
}
}

printhead(argc, argv);
fputs("# ", stdout);
printargs(argc, argv, stdout);

if (bevel > 0.0) {
/* minor faces */
Expand Down Expand Up @@ -226,11 +204,11 @@ char **argv;
side(5, 1, 3, 7);
side(6, 4, 5, 7);
}
exit(0);
return(0);
userr:
fprintf(stderr, "Usage: %s ", argv[0]);
fprintf(stderr, "material name xsize ysize zsize ");
fprintf(stderr, "[-i] [-b bevel | -r rounde]\n");
exit(1);
return(1);
}

63 changes: 22 additions & 41 deletions src/gen/genprism.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: genprism.c,v 2.12 2003/11/16 10:29:38 schorsch Exp $";
static const char RCSid[] = "$Id: genprism.c,v 2.13 2020/07/25 19:18:01 greg Exp $";
#endif
/*
* genprism.c - generate a prism.
Expand All @@ -9,9 +9,8 @@ static const char RCSid[] = "$Id: genprism.c,v 2.12 2003/11/16 10:29:38 schorsch
* orientation.
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "rtio.h"
#include <stdlib.h>
#include <math.h>
#include <ctype.h>

Expand Down Expand Up @@ -40,8 +39,7 @@ static double compute_rounding(void);


static void
readverts(fname) /* read vertices from a file */
char *fname;
readverts(char *fname) /* read vertices from a file */
{
FILE *fp;

Expand All @@ -58,8 +56,7 @@ char *fname;


static void
side(n0, n1) /* print single side */
register int n0, n1;
side(int n0, int n1) /* print single side */
{
printf("\n%s polygon %s.%d\n", pmtype, pname, n0+1);
printf("0\n0\n12\n");
Expand All @@ -75,8 +72,7 @@ register int n0, n1;


static void
rside(n0, n1) /* print side with rounded edge */
register int n0, n1;
rside(int n0, int n1) /* print side with rounded edge */
{
double s, c, t[3];

Expand Down Expand Up @@ -126,10 +122,10 @@ register int n0, n1;


static double
compute_rounding() /* compute vectors for rounding operations */
compute_rounding(void) /* compute vectors for rounding operations */
{
register int i;
register double *v0, *v1;
int i;
double *v0, *v1;
double l, asum;

v0 = vert[nverts-1];
Expand Down Expand Up @@ -170,9 +166,9 @@ compute_rounding() /* compute vectors for rounding operations */


static void
printends() /* print ends of prism */
printends(void) /* print ends of prism */
{
register int i;
int i;
/* bottom face */
printf("\n%s polygon %s.b\n", pmtype, pname);
printf("0\n0\n%d\n", nverts*3);
Expand All @@ -189,9 +185,9 @@ printends() /* print ends of prism */


static void
printrends() /* print ends of prism with rounding */
printrends(void) /* print ends of prism with rounding */
{
register int i;
int i;
double c0[3], c1[3], cl[3];
/* bottom face */
printf("\n%s polygon %s.b\n", pmtype, pname);
Expand Down Expand Up @@ -269,10 +265,9 @@ printrends() /* print ends of prism with rounding */


static void
printsides(round) /* print prism sides */
int round;
printsides(int round) /* print prism sides */
{
register int i;
int i;

for (i = 0; i < nverts-1; i++)
if (round)
Expand All @@ -288,24 +283,8 @@ int round;
}


static void
printhead(ac, av) /* print command header */
register int ac;
register char **av;
{
putchar('#');
while (ac--) {
putchar(' ');
fputs(*av++, stdout);
}
putchar('\n');
}


int
main(argc, argv)
int argc;
char **argv;
main(int argc, char **argv)
{
int an;

Expand Down Expand Up @@ -378,21 +357,23 @@ char **argv;
}
crad *= lvdir; /* simplifies formulas */
compute_rounding();
printhead(argc, argv);
fputs("# ", stdout);
printargs(argc, argv, stdout);
if (do_ends)
printrends();
printsides(1);
} else {
printhead(argc, argv);
fputs("# ", stdout);
printargs(argc, argv, stdout);
if (do_ends)
printends();
printsides(0);
}
exit(0);
return(0);
userr:
fprintf(stderr, "Usage: %s material name ", argv[0]);
fprintf(stderr, "{ - | vfile | N v1 v2 .. vN } ");
fprintf(stderr, "[-l lvect][-r radius][-c][-e]\n");
exit(1);
return(1);
}

24 changes: 4 additions & 20 deletions src/gen/gensky.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef lint
static const char RCSid[] = "$Id: gensky.c,v 2.27 2019/11/07 23:15:07 greg Exp $";
static const char RCSid[] = "$Id: gensky.c,v 2.28 2020/07/25 19:18:01 greg Exp $";
#endif
/*
* gensky.c - program to generate sky functions.
Expand All @@ -10,9 +10,8 @@ static const char RCSid[] = "$Id: gensky.c,v 2.27 2019/11/07 23:15:07 greg Exp $
* 3/26/86
*/

#include <stdio.h>
#include "rtio.h"
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include "sun.h"
Expand Down Expand Up @@ -87,7 +86,6 @@ void printdefaults(void);
void userror(char *msg);
double normsc(void);
int cvthour(char *hs);
void printhead(int ac, char **av);


int
Expand Down Expand Up @@ -184,7 +182,8 @@ main(
"%s: warning - %.1f hours btwn. standard meridian and longitude\n",
progname, (s_longitude-s_meridian)*12/PI);

printhead(argc, argv);
fputs("# ", stdout);
printargs(argc, argv, stdout);

computesky();
printsky();
Expand Down Expand Up @@ -420,18 +419,3 @@ cvthour( /* convert hour string */
putc('\n', stderr);
exit(1);
}


void
printhead( /* print command header */
int ac,
char **av
)
{
putchar('#');
while (ac--) {
putchar(' ');
fputs(*av++, stdout);
}
putchar('\n');
}

0 comments on commit 36c9077

Please sign in to comment.