--- ray/src/common/cone.c 1992/11/19 21:32:48 2.4 +++ ray/src/common/cone.c 2003/07/27 22:12:01 2.9 @@ -1,15 +1,12 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: cone.c,v 2.9 2003/07/27 22:12:01 schorsch Exp $"; #endif - /* * cone.c - routines for making cones - * - * 2/12/86 */ +#include "copyright.h" + #include "standard.h" #include "object.h" @@ -59,7 +56,7 @@ int getxf; co->ca = o->oargs.farg; /* get radii */ - if (o->otype == OBJ_CYLINDER | o->otype == OBJ_TUBE) { + if ((o->otype == OBJ_CYLINDER) | (o->otype == OBJ_TUBE)) { if (o->oargs.nfargs != 7) goto argcerr; if (co->ca[6] < -FTINY) { @@ -82,7 +79,7 @@ int getxf; else sgn1 = 0; if (sgn0+sgn1 == 0) goto raderr; - if (sgn0 < 0 | sgn1 < 0) { + if ((sgn0 < 0) | (sgn1 < 0)) { objerror(o, o->otype==OBJ_RING?USER:WARNING, "negative radii"); o->otype = o->otype == OBJ_CONE ? @@ -129,7 +126,7 @@ int getxf; if (o->otype == OBJ_RING) { co->al = 0.0; co->sl = CO_R1(co) - CO_R0(co); - } else if (o->otype == OBJ_CONE | o->otype == OBJ_CUP) { + } else if ((o->otype == OBJ_CONE) | (o->otype == OBJ_CUP)) { co->sl = co->ca[7] - co->ca[6]; co->sl = sqrt(co->sl*co->sl + co->al*co->al); } else { /* OBJ_CYLINDER or OBJ_TUBE */ @@ -146,9 +143,11 @@ argcerr: objerror(o, USER, "bad # arguments"); raderr: objerror(o, USER, "illegal radii"); + return NULL; /* pro forma return */ } +void freecone(o) /* free memory associated with cone */ OBJREC *o; { @@ -157,12 +156,13 @@ OBJREC *o; if (co == NULL) return; if (co->tm != NULL) - free((char *)co->tm); - free((char *)co); + free((void *)co->tm); + free((void *)co); o->os = NULL; } +void conexform(co) /* get cone transformation matrix */ register CONE *co; { @@ -170,7 +170,7 @@ register CONE *co; register double d; register int i; - co->tm = (FLOAT (*)[4])malloc(sizeof(MAT4)); + co->tm = (RREAL (*)[4])malloc(sizeof(MAT4)); if (co->tm == NULL) error(SYSTEM, "out of memory in conexform"); @@ -206,7 +206,7 @@ register CONE *co; multmat4(co->tm, co->tm, m4); /* scale z-axis */ - if (co->p0 != co->p1 & co->r0 != co->r1) { + if ((co->p0 != co->p1) & (co->r0 != co->r1)) { setident4(m4); m4[2][2] = (CO_R1(co) - CO_R0(co)) / co->al; multmat4(co->tm, co->tm, m4);