| 1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* Routines for converting holodeck coordinates, etc. |
| 6 |
|
* |
| 51 |
|
hp->wi[i] *= hp->grid[hdwg0[i-1]] * hp->grid[hdwg1[i-1]]; |
| 52 |
|
hp->wi[i] += hp->wi[i-1]; |
| 53 |
|
} |
| 57 |
– |
} |
| 58 |
– |
|
| 59 |
– |
|
| 60 |
– |
HOLO * |
| 61 |
– |
hdalloc(hproto) /* allocate and set holodeck section based on grid */ |
| 62 |
– |
HDGRID *hproto; |
| 63 |
– |
{ |
| 64 |
– |
HOLO hdhead; |
| 65 |
– |
register HOLO *hp; |
| 66 |
– |
int n; |
| 67 |
– |
/* copy grid to temporary header */ |
| 68 |
– |
bcopy((char *)hproto, (char *)&hdhead, sizeof(HDGRID)); |
| 69 |
– |
/* compute grid vectors and sizes */ |
| 70 |
– |
hdcompgrid(&hdhead); |
| 71 |
– |
/* allocate header with directory */ |
| 72 |
– |
n = sizeof(HOLO)+nbeams(&hdhead)*sizeof(BEAMI); |
| 73 |
– |
if ((hp = (HOLO *)malloc(n)) == NULL) |
| 74 |
– |
return(NULL); |
| 75 |
– |
/* copy header information */ |
| 76 |
– |
copystruct(hp, &hdhead); |
| 77 |
– |
/* allocate and clear beam list */ |
| 78 |
– |
hp->bl = (BEAM **)malloc((nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM)); |
| 79 |
– |
if (hp->bl == NULL) { |
| 80 |
– |
free((char *)hp); |
| 81 |
– |
return(NULL); |
| 82 |
– |
} |
| 83 |
– |
bzero((char *)hp->bl, (nbeams(hp)+1)*sizeof(BEAM *)+sizeof(BEAM)); |
| 84 |
– |
hp->bl[0] = (BEAM *)(hp->bl+nbeams(hp)+1); /* set blglob(hp) */ |
| 85 |
– |
hp->fd = -1; |
| 86 |
– |
hp->dirty = 0; |
| 87 |
– |
hp->priv = NULL; |
| 88 |
– |
/* clear beam directory */ |
| 89 |
– |
bzero((char *)hp->bi, (nbeams(hp)+1)*sizeof(BEAMI)); |
| 90 |
– |
return(hp); /* all is well */ |
| 54 |
|
} |
| 55 |
|
|
| 56 |
|
|