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

Comparing ray/src/hd/rhdisp.c (file contents):
Revision 3.40 by gwlarson, Thu Mar 4 10:14:52 1999 UTC vs.
Revision 3.49 by schorsch, Sun Jul 27 22:12:02 2003 UTC

# Line 1 | Line 1
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   * Holodeck display process.
6   */
7  
8 + #include <string.h>
9 + #include <ctype.h>
10 +
11   #include "rholo.h"
12   #include "rhdisp.h"
13   #include "rhdriver.h"
14   #include "selcall.h"
15 #include <ctype.h>
15  
16   #ifndef VIEWHISTLEN
17   #define VIEWHISTLEN     4       /* number of remembered views */
# Line 22 | Line 21 | static char SCCSid[] = "$SunId$ SGI";
21   #define FSIZDEF         0.125   /* default focus frame size */
22   #endif
23  
24 + #if defined(freebsd)
25 + #define fbufcnt(f)      ((f)->_r)
26 + #elif defined(__GNUC__)
27 + #define fbufcnt(f)      ((f)->_IO_read_end - (f)->_IO_read_ptr)
28 + #else
29 + #define fbufcnt(f)      ((f)->_cnt)
30 + #endif
31 +
32   HOLO    *hdlist[HDMAX+1];       /* global holodeck list */
33  
34   char    *hdgfn[HDMAX];          /* holodeck section geometry list */
# Line 40 | Line 47 | char   *progname;              /* global argv[0] */
47   FILE    *sstdin, *sstdout;      /* server's standard input and output */
48  
49   #ifdef DEBUG
43 #include <sys/types.h>
50   extern time_t   time();
51   static time_t   tmodesw;
52   static time_t   timm, tadd;
# Line 56 | Line 62 | main(argc, argv)
62   int     argc;
63   char    *argv[];
64   {
59        extern int      eputs();
65          int     rdy, inp, res = 0, pause = 0;
66  
67          progname = argv[0];
# Line 158 | Line 163 | disp_wait()                    /* wait for more input */
163          if (hdlist[0] == NULL)
164                  return(RDY_SRV);        /* initialize first */
165          flgs = 0;               /* flag what's ready already */
166 <        if (imm_mode || stdin->_cnt > 0)
166 >        if (imm_mode || fbufcnt(stdin) > 0)
167                  flgs |= RDY_SRV;
168 <        if (sstdin != NULL && sstdin->_cnt > 0)
168 >        if (sstdin != NULL && fbufcnt(sstdin) > 0)
169                  flgs |= RDY_SIN;
170          if (odev.inpready)
171                  flgs |= RDY_DEV;
# Line 213 | Line 218 | char   *gfn, *pfn;
218          hdlist[hd] = (HOLO *)malloc(sizeof(HOLO));
219          if (hdlist[hd] == NULL)
220                  error(SYSTEM, "out of memory in add_holo");
221 <        bcopy((char *)hdg, (char *)hdlist[hd], sizeof(HDGRID));
221 >        memcpy((void *)hdlist[hd], (void *)hdg, sizeof(HDGRID));
222          hdcompgrid(hdlist[hd]);
223          hdgfn[hd] = savestr(gfn);
224          hdpfn[hd] = pfn && *pfn ? savestr(pfn) : (char *)NULL;
225          if (hd)
226                  return;
227                                          /* set initial viewpoint */
228 <        copystruct(&nv, &odev.v);
228 >        nv = odev.v;
229          VSUM(nv.vp, hdlist[0]->orig, hdlist[0]->xv[0], 0.5);
230          VSUM(nv.vp, nv.vp, hdlist[0]->xv[1], 0.5);
231          VSUM(nv.vp, nv.vp, hdlist[0]->xv[2], 0.5);
# Line 244 | Line 249 | register PACKHEAD      *p;
249          double  d;
250          register int    i;
251                                          /* get beam coordinates */
252 <        if (p->hd < 0 | p->hd >= HDMAX || hdlist[p->hd] == NULL)
252 >        if ((p->hd < 0) | (p->hd >= HDMAX) || hdlist[p->hd] == NULL)
253                  error(INTERNAL, "bad holodeck number in disp_bundle");
254          if (!hdbcoord(gc, hdlist[p->hd], p->bi))
255                  error(INTERNAL, "bad beam index in disp_bundle");
# Line 272 | Line 277 | register VIEW  *v;
277          static unsigned nhist;
278          VIEW    *dv;
279          int     i, res[2];
280 <        int2    *slist;
280 >        int16   *slist;
281          char    *err;
282                                  /* restore previous view? */
283          if (v == NULL) {
# Line 301 | Line 306 | again:
306                                  error(COMMAND, "invalid starting view");
307                                  return;
308                          }
309 <                        copystruct(v, viewhist + ((nhist-1)%VIEWHISTLEN));
309 >                        *v = *(viewhist + ((nhist-1)%VIEWHISTLEN));
310                          goto again;     /* poss. overloading dev_section()? */
311                  }
312                  DCHECK(*slist < 0, WARNING, "no visible sections in new_view");
# Line 314 | Line 319 | again:
319          imm_mode = beam_sync(odev.firstuse) > 0;
320                                  /* record new view */
321          if (v < viewhist || v >= viewhist+VIEWHISTLEN) {
322 <                copystruct(viewhist + (nhist%VIEWHISTLEN), v);
322 >                *(viewhist + (nhist%VIEWHISTLEN)) = *v;
323                  nhist++;
324          }
325   }
# Line 344 | Line 349 | char   *args;
349          beam_init(0);                                   /* add basic views */
350          for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++)
351                  beam_view(dv, res[0]>>4, res[1]>>4);
352 <        copystruct(&vwfocus, &odev.v);                  /* add focus view */
352 >        vwfocus = odev.v;                       /* add focus view */
353          switch (odev.v.type) {
354          case VT_PER:
355                  vwfocus.horiz = 2.*180./PI*atan(
# Line 410 | Line 415 | usr_input()                    /* get user input and process it */
415          }
416          switch (i) {
417          case DC_SETVIEW:                /* set the view */
418 <                copystruct(&vparams, &odev.v);
418 >                vparams = odev.v;
419                  if (!sscanview(&vparams, args))
420                          error(COMMAND, "missing view options");
421                  else
# Line 476 | Line 481 | serv_result()                  /* get next server result and process
481                          if (buf == NULL)
482                                  buf = (char *)malloc(bufsiz=msg.nbytes);
483                          else
484 <                                buf = (char *)realloc(buf, bufsiz=msg.nbytes);
484 >                                buf = (char *)realloc((void *)buf,
485 >                                                bufsiz=msg.nbytes);
486                          if (buf == NULL)
487                                  error(SYSTEM, "out of memory in serv_result");
488                  }
# Line 563 | Line 569 | char   *p;
569   }
570  
571  
572 + void
573   eputs(s)                        /* put error message to stderr */
574   register char  *s;
575   {
# Line 582 | Line 589 | register char  *s;
589   }
590  
591  
592 + void
593   quit(code)                      /* clean up and exit */
594   int     code;
595   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines