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

Comparing ray/src/hd/holofile.c (file contents):
Revision 3.39 by gwlarson, Tue Mar 9 08:40:11 1999 UTC vs.
Revision 3.40 by gwlarson, Fri Mar 12 09:37:48 1999 UTC

# Line 61 | Line 61 | static struct fraglist {
61   static int      nhdfragls;      /* size of hdfragl array */
62  
63  
64 + HOLO *
65 + hdalloc(hproto)         /* allocate and set holodeck section based on grid */
66 + HDGRID  *hproto;
67 + {
68 +        HOLO    hdhead;
69 +        register HOLO   *hp;
70 +        int     n;
71 +                                /* copy grid to temporary header */
72 +        bcopy((char *)hproto, (char *)&hdhead, sizeof(HDGRID));
73 +                                /* compute grid vectors and sizes */
74 +        hdcompgrid(&hdhead);
75 +                                /* allocate header with directory */
76 +        n = sizeof(HOLO)+nbeams(&hdhead)*sizeof(BEAMI);
77 +        if ((hp = (HOLO *)malloc(n)) == NULL)
78 +                return(NULL);
79 +                                /* copy header information */
80 +        copystruct(hp, &hdhead);
81 +                                /* allocate and clear beam list */
82 +        hp->bl = (BEAM **)malloc((nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM));
83 +        if (hp->bl == NULL) {
84 +                free((char *)hp);
85 +                return(NULL);
86 +        }
87 +        bzero((char *)hp->bl, (nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM));
88 +        hp->bl[0] = (BEAM *)(hp->bl+nbeams(hp)+1);      /* set blglob(hp) */
89 +        hp->fd = -1;
90 +        hp->dirty = 0;
91 +        hp->priv = NULL;
92 +                                /* clear beam directory */
93 +        bzero((char *)hp->bi, (nbeams(hp)+1)*sizeof(BEAMI));
94 +        return(hp);             /* all is well */
95 + }
96 +
97 +
98   char *
99   hdrealloc(ptr, siz, rout)       /* (re)allocate memory, retry then error */
100   char    *ptr;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines