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

Comparing ray/src/util/glrad.c (file contents):
Revision 3.10 by gwlarson, Thu Oct 15 08:30:48 1998 UTC vs.
Revision 3.29 by greg, Tue Jun 3 21:31:51 2025 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   * Program to display Radiance scene using OpenGL.
6   */
7  
11 #include "radogl.h"
12 #include "view.h"
13 #include "paths.h"
8   #include <sys/types.h>
9   #include <GL/glx.h>
10   #ifndef NOSTEREO
11   #include <X11/extensions/SGIStereo.h>
12   #endif
13   #include <ctype.h>
14 + #include <string.h>
15 + #include <time.h>
16 +
17 + #include "radogl.h"
18 + #include "view.h"
19 + #include "paths.h"
20   #include "glradicon.h"
21 + #include "rtprocess.h"
22  
23   #ifndef MAXVIEW
24   #define MAXVIEW         63              /* maximum number of standard views */
# Line 26 | Line 27 | static char SCCSid[] = "$SunId$ SGI";
27   #define MAXSCENE        127             /* maximum number of scene files */
28   #endif
29  
30 < #define ZOOMPCT         9               /* percent to zoom at a time */
30 > #define ZOOMPCT         9               /* percent to zoom for +/- */
31 > #define WZOOMPCT        3               /* percent to zoom for mouse wheel */
32  
33 < #define MOVPCT          7               /* percent distance to move /frame */
33 > #define MOVPCT          4               /* percent distance to move /frame */
34   #define MOVDIR(b)       ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)
35 < #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
35 > #define MOVDEG          (-1.5)          /* degrees to orbit CW/down /frame */
36   #define MOVORB(s)       ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0)
37  
38   #define BORWIDTH        5               /* border width */
# Line 68 | Line 70 | VIEW   thisview = STDVIEW;             /* displayed view */
70   double  eyedist = 1;                    /* interocular distance */
71   VIEW    lastview;                       /* last recorded view */
72  
71 char    *progname;                      /* global argv[0] */
73   char    *radfile;                       /* rad input file */
74   char    *scene[MAXSCENE+1];             /* material and scene file list */
75   int     nscenef = 0;                    /* number of scene files */
76   char    *octree;                        /* octree name (NULL if unnec.) */
77  
78 < int     rtpd[3];                        /* rtrace process descriptors */
78 > SUBPROC rtpd = SP_INACTIVE;             /* rtrace process descriptors */
79  
80   int     silent = 0;                     /* run rad silently? */
81   int     backvis = 1;                    /* back faces visible? */
82   int     stereo = 0;                     /* do stereo? */
83  
84   #ifdef NOSTEREO
85 < #define setstereobuf(bid)       0
85 > #define setstereobuf(bid)      
86   #else
87   #define setstereobuf(bid)       (glXWaitGL(), \
88                                  XSGISetStereoBuffer(ourdisplay, gwind, bid), \
# Line 92 | Line 93 | int    displist;                       /* our scene display list */
93  
94   int     no_render = 0;                  /* don't rerender */
95  
95 #ifdef BSD
96 #define strchr          index
97 #endif
98
99 extern char     *strchr(), *fgets(), *fgetline(), *atos(), *scan4var();
96   extern int      nowarn;                 /* turn warnings off? */
101 extern time_t   time();
97  
98 + static void startrtrace(char    *octname);
99 + static void runrad(int  ac, char        **av);
100 + static int findvw(char  *nm);
101 + static int varmatch(char        *s, char        *vn);
102 + static char * scan4var(char     *buf, int       buflen, char    *vname, FILE    *fp);
103 + static void dev_open(char  *id);
104 + static void dev_close(void);
105 + static int dev_view(VIEW        *nv);
106 + static int dev_input(int        nsecs);
107 + static void render(void);
108 + static int moveview(int dx, int dy, int mov, int        orb);
109 + static void waitabit(void);
110 + static void getmove(XButtonPressedEvent *ebut);
111 + static int getintersect(FVECT   wp, FVECT       org, FVECT      dir, double     md);
112 + static void setglpersp(VIEW     *vp);
113 + static int getkey(XKeyPressedEvent  *ekey);
114 + static void zoomview(int        pct, int        dx, int dy);
115 + static void gotoview(int        vwnum);
116 + static void appendview(char     *nm, VIEW       *vp);
117 + static void copylastv(char      *cause);
118 + static void fixwindow(XExposeEvent  *eexp);
119 + static void resizewindow(XConfigureEvent  *ersz);
120  
121 < main(argc, argv)
122 < int     argc;
123 < char    *argv[];
121 >
122 > int
123 > main(
124 >        int     argc,
125 >        char    *argv[]
126 > )
127   {
128          char    *viewsel = NULL;
129          long    vwintvl = 0;
130          int     i;
131 <
132 <        progname = argv[0];
131 >                                        /* set global progname */
132 >        fixargv0(argv[0]);
133          for (i = 1; i < argc && argv[i][0] == '-'; i++)
134                  switch (argv[i][1]) {
135                  case 'v':
# Line 142 | Line 162 | char   *argv[];
162                                          /* run rad and get views */
163          runrad(argc-i, argv+i);
164                                          /* check view */
165 <        if (viewsel != NULL)
165 >        if (viewsel != NULL) {
166                  if (viewsel[0] == '-') {
167                          char    *ve = viewsel;
168                          if (!sscanview(&thisview, viewsel) ||
# Line 157 | Line 177 | char   *argv[];
177                                                  progname, viewsel);
178                          quit(1);
179                  }
180 +        }
181                                          /* open GL */
182          dev_open(radfile = argv[i]);
183                                          /* load octree or scene files */
184          if (octree != NULL) {
185 <                displist = rgl_octlist(octree, NULL, NULL);
185 >                displist = rgl_octlist(octree, NULL, NULL, NULL);
186                  startrtrace(octree);
187          } else
188 <                displist = rgl_filelist(nscenef, scene);
188 >                displist = rgl_filelist(nscenef, scene, NULL);
189                                          /* set initial view */
190          dev_view(currentview < 0 ? &thisview : vwl[currentview].v);
191                                          /* input/render loop */
# Line 177 | Line 198 | userr:
198                  "Usage: %s [-w][-s][-b][-S][-v view] rfile [VAR=value]..\n",
199                          argv[0]);
200          quit(1);
201 +        return 1; /* pro forma return */
202   }
203  
204  
205 < quit(code)                              /* exit gracefully */
206 < int     code;
205 > void
206 > quit(                           /* exit gracefully */
207 >        int     code
208 > )
209   {
210          if (ourdisplay != NULL)
211                  dev_close();
212 <        if (rtpd[2] > 0) {
213 <                if (close_process(rtpd) > 0)
212 >        /* if (rtpd.pid > 0) { */
213 >        if (rtpd.flags & PF_RUNNING) {
214 >                if (close_process(&rtpd) > 0)
215                          wputs("bad exit status from rtrace\n");
216 <                rtpd[2] = 0;
216 >                /* rtpd.pid = 0; */
217          }
218          exit(code);
219   }
220  
221  
222 < startrtrace(octname)                    /* start rtrace on octname */
223 < char    *octname;
222 > static void
223 > startrtrace(                    /* start rtrace on octname */
224 >        char    *octname
225 > )
226   {
227          static char     *av[12] = {"rtrace", "-h", "-fff", "-ld+",
228                                          "-opL", "-x", "1"};
# Line 204 | Line 231 | char   *octname;
231          if (nowarn) av[ac++] = "-w-";
232          av[ac++] = octname;
233          av[ac] = NULL;
234 <        if (open_process(rtpd, av) <= 0)
234 >        if (open_process(&rtpd, av) <= 0)
235                  error(SYSTEM, "cannot start rtrace process");
236   }
237  
238  
239 < runrad(ac, av)                          /* run rad and load variables */
240 < int     ac;
241 < char    **av;
239 > static void
240 > runrad(                         /* run rad and load variables */
241 >        int     ac,
242 >        char    **av
243 > )
244   {
245          static char     optfile[] = TEMPLATE;
246          int     nvn = 0, nvv = 0;
247          FILE    *fp;
248 <        int     cval;
220 <        register char   *cp;
248 >        char    *cp;
249          char    radcomm[256], buf[128], nam[32];
250                                          /* set rad commmand */
251          strcpy(radcomm, "rad -w -v 0        "); /* look out below! */
# Line 244 | Line 272 | char   **av;
272                                                  /* get exposure */
273          if ((cp = scan4var(buf, sizeof(buf), "EXPOSURE", fp)) != NULL) {
274                  expval = atof(cp);
275 <                if (*cp == '-' | *cp == '+')
275 >                if ((*cp == '-') | (*cp == '+'))
276                          expval = pow(2., expval);
277                  expval *= 0.5;          /* compensate for local shading */
278          }
# Line 253 | Line 281 | char   **av;
281                  eyedist = atof(cp);
282                                                  /* look for materials */
283          while ((cp = scan4var(buf, sizeof(buf), "materials", fp)) != NULL) {
284 <                nscenef += wordstring(scene+nscenef, cp);
284 >                nscenef += wordstring(scene+nscenef, MAXSCENE-nscenef, cp);
285                  buf[0] = '\0';
286          }
287                                                  /* look for octree */
# Line 261 | Line 289 | char   **av;
289                  octree = savqstr(cp);
290                                                  /* look for scene files */
291          while ((cp = scan4var(buf, sizeof(buf), "scene", fp)) != NULL) {
292 <                nscenef += wordstring(scene+nscenef, cp);
292 >                nscenef += wordstring(scene+nscenef, MAXSCENE-nscenef, cp);
293                  buf[0] = '\0';
294          }
295                                                  /* load view names */
# Line 276 | Line 304 | char   **av;
304          do
305                  if (isview(buf)) {
306                          vwl[nvv].v = (VIEW *)bmalloc(sizeof(VIEW));
307 <                        copystruct(vwl[nvv].v, &stdview);
307 >                        *(vwl[nvv].v) = stdview;
308                          sscanview(vwl[nvv].v, buf);
309                          if ((cp = setview(vwl[nvv++].v)) != NULL) {
310                                  fprintf(stderr, "%s: bad view %d - %s\n",
# Line 305 | Line 333 | char   **av;
333   }
334  
335  
336 < int
337 < findvw(nm)                      /* find named view */
338 < register char   *nm;
336 > static int
337 > findvw(                 /* find named view */
338 >        char    *nm
339 > )
340   {
341 <        register int    n;
341 >        int     n;
342  
343 <        if (*nm >= '1' & *nm <= '9' &&
343 >        if ((*nm >= '1') & (*nm <= '9') &&
344                          (n = atoi(nm)-1) <= MAXVIEW && vwl[n].v != NULL)
345                  return(n);
346          for (n = 0; vwl[n].v != NULL; n++)
# Line 321 | Line 350 | register char  *nm;
350   }
351  
352  
353 < int
354 < varmatch(s, vn)                         /* match line to variable */
355 < register char   *s, *vn;
353 > static int
354 > varmatch(                               /* match line to variable */
355 >        char    *s,
356 >        char    *vn
357 > )
358   {
359 <        register int    c;
359 >        int     c;
360  
361          for ( ; *vn && *s == *vn; s++, vn++)
362                  ;
# Line 339 | Line 370 | register char  *s, *vn;
370   }
371  
372  
373 < char *
374 < scan4var(buf, buflen, vname, fp)        /* scan for variable from fp */
375 < char    *buf;
376 < int     buflen;
377 < char    *vname;
378 < FILE    *fp;
373 > static char *
374 > scan4var(       /* scan for variable from fp */
375 >        char    *buf,
376 >        int     buflen,
377 >        char    *vname,
378 >        FILE    *fp
379 > )
380   {
381          int     cval;
382 <        register char   *cp;
382 >        char    *cp;
383                                          /* search out matching line */
384          while ((cval = varmatch(buf, vname))) {
385                  if (cval > 0)                   /* gone too far? */
# Line 364 | Line 396 | FILE   *fp;
396   }
397  
398  
399 < dev_open(id)                    /* initialize GLX driver */
400 < char  *id;
399 > static void
400 > dev_open(                       /* initialize GLX driver */
401 >        char  *id
402 > )
403   {
404          static int      atlBest[] = {GLX_RGBA, GLX_RED_SIZE,4,
405                                  GLX_GREEN_SIZE,4, GLX_BLUE_SIZE,4,
# Line 415 | Line 449 | char  *id;
449                                          /* set window manager hints */
450          ourxwmhints.flags = InputHint|IconPixmapHint;
451          ourxwmhints.input = True;
452 <        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay,
453 <                gwind, glradicon_bits, glradicon_width, glradicon_height);
452 >        ourxwmhints.icon_pixmap = XCreateBitmapFromData(ourdisplay, gwind,
453 >                (char *)glradicon_bits, glradicon_width, glradicon_height);
454          XSetWMHints(ourdisplay, gwind, &ourxwmhints);
455                                          /* set GLX context */
456          glXMakeCurrent(ourdisplay, gwind, gctx);
# Line 447 | Line 481 | char  *id;
481          no_render++;
482          do
483                  dev_input(0);           /* get resize event */
484 <        while (hres == 0 & vres == 0);
484 >        while ((hres == 0) & (vres == 0));
485          no_render--;
486          rgl_checkerr("initializing GLX");
487   }
488  
489  
490 < dev_close()                     /* close our display and free resources */
490 > static void
491 > dev_close(void)                 /* close our display and free resources */
492   {
493          glXMakeCurrent(ourdisplay, None, NULL);
494          glXDestroyContext(ourdisplay, gctx);
# Line 464 | Line 499 | dev_close()                    /* close our display and free resources
499   }
500  
501  
502 < int
503 < dev_view(nv)                    /* assign new driver view */
504 < register VIEW   *nv;
502 > static int
503 > dev_view(                       /* assign new driver view */
504 >        VIEW    *nv
505 > )
506   {
507          int     newhres = hres, newvres = vres;
508          double  wa, va;
# Line 475 | Line 511 | register VIEW  *nv;
511                  error(COMMAND, "illegal view type");
512                  nv->type = VT_PER;
513          }
514 <        if (nv->horiz > 160. | nv->vert > 160.) {
514 >        if ((nv->horiz > 160.) | (nv->vert > 160.)) {
515                  error(COMMAND, "illegal view angle");
516                  if (nv->horiz > 160.)
517                          nv->horiz = 160.;
518                  if (nv->vert > 160.)
519                          nv->vert = 160.;
520          }
521 <        if (hres != 0 & vres != 0) {
521 >        if ((hres != 0) & (vres != 0)) {
522                  wa = (vres*pheight)/(hres*pwidth);
523                  va = viewaspect(nv);
524                  if (va > wa+.05) {
# Line 498 | Line 534 | register VIEW  *nv;
534                                  newvres = (pwidth/pheight)*va*newhres + .5;
535                          }
536                  }
537 <                if (newhres != hres | newvres != vres) {
537 >                if ((newhres != hres) | (newvres != vres)) {
538                          no_render++;
539                          XResizeWindow(ourdisplay, gwind, newhres, newvres);
540                          do
541                                  dev_input(0);           /* get resize event */
542 <                        while (newhres != hres | newvres != vres);
542 >                        while ((newhres != hres) & (newvres != vres));
543                          no_render--;
544                  }
545          }
546 <        copystruct(&thisview, nv);
546 >        thisview = *nv;
547          setglpersp(&thisview);
548          render();
549          return(1);
550   }
551  
552  
553 < int
554 < dev_input(nsecs)                /* get next input event */
555 < int     nsecs;
553 > static int
554 > dev_input(              /* get next input event */
555 >        int     nsecs
556 > )
557   {
558   #if 0
559          static time_t   lasttime = 0;
# Line 547 | Line 584 | int    nsecs;
584          case KeyPress:
585                  return(getkey(levptr(XKeyPressedEvent)));
586          case ButtonPress:
587 <                getmove(levptr(XButtonPressedEvent));
587 >                switch (levptr(XButtonPressedEvent)->button) {
588 >                case Button4:                   /* wheel up */
589 >                        zoomview(100+WZOOMPCT, levptr(XButtonPressedEvent)->x,
590 >                                        vres-1-levptr(XButtonPressedEvent)->y);
591 >                        break;
592 >                case Button5:                   /* wheel down */
593 >                        zoomview(100-WZOOMPCT, levptr(XButtonPressedEvent)->x,
594 >                                        vres-1-levptr(XButtonPressedEvent)->y);
595 >                        break;
596 >                default:
597 >                        getmove(levptr(XButtonPressedEvent));
598 >                        break;
599 >                }
600                  break;
601          }
602          return(1);
603   }
604  
605  
606 < render()                        /* render our display list and swap buffers */
606 > static void
607 > render(void)                    /* render our display list and swap buffers */
608   {
609          double  d;
610  
# Line 580 | Line 630 | render()                       /* render our display list and swap buffers
630   }
631  
632  
633 < moveview(dx, dy, mov, orb)      /* move our view */
634 < int     dx, dy, mov, orb;
633 > static int
634 > moveview(       /* move our view */
635 >        int     dx,
636 >        int     dy,
637 >        int     mov,
638 >        int     orb
639 > )
640   {
641          VIEW    nv;
642          FVECT   odir, v1, wp;
643          double  d;
589        register int    li;
644                                  /* start with old view */
645 <        copystruct(&nv, &thisview);
645 >        nv = thisview;
646                                  /* change view direction */
647          if ((d = viewray(v1, odir, &thisview,
648                          (dx+.5)/hres, (dy+.5)/vres)) < -FTINY)
# Line 604 | Line 658 | int    dx, dy, mov, orb;
658                  VSUM(nv.vp, wp, odir, -1.);
659                  spinvector(nv.vdir, nv.vdir, nv.vup, d);
660          } else if (orb) {               /* orbit up/down */
661 <                fcross(v1, odir, nv.vup);
662 <                if (normalize(v1) == 0.)
661 >                if (geodesic(odir, odir, nv.vup,
662 >                                d=MOVDEG*PI/180.*orb, GEOD_RAD) == 0.0)
663                          return(0);
610                spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb);
664                  VSUM(nv.vp, wp, odir, -1.);
665 <                spinvector(nv.vdir, nv.vdir, v1, d);
665 >                geodesic(nv.vdir, nv.vdir, nv.vup, d, GEOD_RAD);
666          } else if (mov) {               /* move forward/backward */
667                  d = MOVPCT/100. * mov;
668                  VSUM(nv.vp, nv.vp, odir, d);
# Line 626 | Line 679 | int    dx, dy, mov, orb;
679   }
680  
681  
682 < getmove(ebut)                           /* get view change */
683 < XButtonPressedEvent     *ebut;
682 > static void
683 > waitabit(void)                          /* pause a moment */
684   {
685 +        struct timespec ts;
686 +        ts.tv_sec = 0;
687 +        ts.tv_nsec = 50000000;
688 +        nanosleep(&ts, NULL);
689 + }
690 +
691 +
692 + static void
693 + getmove(                                /* get view change */
694 +        XButtonPressedEvent     *ebut
695 + )
696 + {
697          int     movdir = MOVDIR(ebut->button);
698          int     movorb = MOVORB(ebut->state);
699          int     moved = 0;
# Line 642 | Line 707 | XButtonPressedEvent    *ebut;
707  
708          while (!XCheckMaskEvent(ourdisplay,
709                          ButtonReleaseMask, levptr(XEvent))) {
710 +                                        /* pause so as not to move too fast */
711 +                waitabit();
712  
713                  if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
714                                  &rootx, &rooty, &wx, &wy, &statemask))
# Line 662 | Line 729 | XButtonPressedEvent    *ebut;
729   }
730  
731  
732 < getintersect(wp, org, dir, md)          /* intersect ray with scene geometry */
733 < FVECT   wp;             /* returned world intersection point */
734 < FVECT   org, dir;
735 < double  md;
732 > static int
733 > getintersect(           /* intersect ray with scene geometry */
734 >        FVECT   wp,             /* returned world intersection point */
735 >        FVECT   org,
736 >        FVECT   dir,
737 >        double  md
738 > )
739   {
740          float   fbuf[6];
741                                  /* check to see if rtrace is running */
742 <        if (rtpd[2] <= 0)
742 >        /* if (rtpd.pid <= 0) */
743 >        if (!(rtpd.flags & PF_RUNNING))
744                  return(0);
745                                  /* assign origin */
746          fbuf[0] = org[0]; fbuf[1] = org[1]; fbuf[2] = org[2];
# Line 677 | Line 748 | double md;
748          if (md <= FTINY) md = FHUGE;
749          fbuf[3] = dir[0]*md; fbuf[4] = dir[1]*md; fbuf[5] = dir[2]*md;
750                                  /* trace that ray */
751 <        if (process(rtpd, fbuf, fbuf, 4*sizeof(float), 6*sizeof(float)) !=
752 <                        4*sizeof(float))
751 >        if (process(&rtpd, fbuf, fbuf,
752 >                        4*sizeof(float), 6*sizeof(float)) != 4*sizeof(float))
753                  error(INTERNAL, "error getting data back from rtrace process");
754          if (fbuf[3] >= .99*FHUGE)
755                  return(0);      /* missed local objects */
# Line 687 | Line 758 | double md;
758   }
759  
760  
761 < setglpersp(vp)                  /* set perspective view in GL */
762 < register VIEW   *vp;
761 > static void
762 > setglpersp(                     /* set perspective view in GL */
763 >        VIEW    *vp
764 > )
765   {
766          double  d, xmin, xmax, ymin, ymax, zmin, zmax;
767  
# Line 719 | Line 792 | register VIEW  *vp;
792   }
793  
794  
795 < int
796 < getkey(ekey)                            /* get input key */
797 < register XKeyPressedEvent  *ekey;
795 > static int
796 > getkey(                         /* get input key */
797 >        XKeyPressedEvent  *ekey
798 > )
799   {
800          int  n;
801          char    buf[8];
# Line 739 | Line 813 | register XKeyPressedEvent  *ekey;
813          case 'l':                       /* retrieve last (premouse) view */
814                  if (lastview.type) {
815                          VIEW    vtmp;
816 <                        copystruct(&vtmp, &thisview);
816 >                        vtmp = thisview;
817                          dev_view(&lastview);
818 <                        copystruct(&lastview, &vtmp);
818 >                        lastview = vtmp;
819                  } else
820                          XBell(ourdisplay, 0);
821                  break;
# Line 765 | Line 839 | register XKeyPressedEvent  *ekey;
839          case 'V':                       /* append view to rad file */
840                  appendview(NULL, &thisview);
841                  break;
842 +        case 'Q':
843          case 'q':                       /* quit the program */
844                  return(0);
845          default:
# Line 775 | Line 850 | register XKeyPressedEvent  *ekey;
850   }
851  
852  
853 < zoomview(pct, dx, dy)                   /* zoom in or out around (dx,dy) */
854 < int     pct;
855 < int     dx, dy;
853 > static void
854 > zoomview(                       /* zoom in or out around (dx,dy) */
855 >        int     pct,
856 >        int     dx,
857 >        int     dy
858 > )
859   {
860          double  h, v;
783        FVECT   direc;
861  
862 <        if (pct == 100 | pct <= 0)
862 >        if ((pct == 100) | (pct <= 0))
863                  return;
864          copylastv("zooming");
865          h = (dx+.5)/hres - 0.5;
# Line 801 | Line 878 | int    dx, dy;
878   }
879  
880  
881 < gotoview(vwnum)                         /* go to specified view number */
882 < int     vwnum;
881 > static void
882 > gotoview(                               /* go to specified view number */
883 >        int     vwnum
884 > )
885   {
886          if (vwnum < 0)
887                  for (vwnum = currentview; vwl[vwnum+1].v != NULL; vwnum++)
# Line 814 | Line 893 | int    vwnum;
893   }
894  
895  
896 < appendview(nm, vp)                      /* append standard view */
897 < char    *nm;
898 < VIEW    *vp;
896 > static void
897 > appendview(                     /* append standard view */
898 >        char    *nm,
899 >        VIEW    *vp
900 > )
901   {
902          FILE    *fp;
903                                          /* check if already in there */
904 <        if (!bcmp(&thisview, vwl[currentview].v, sizeof(VIEW))) {
904 >        if (!memcmp(&thisview, vwl[currentview].v, sizeof(VIEW))) {
905                  error(COMMAND, "view already in standard list");
906                  return;
907          }
# Line 841 | Line 922 | VIEW   *vp;
922          if (currentview >= MAXVIEW)
923                  error(INTERNAL, "too many views in appendview");
924          vwl[currentview].v = (VIEW *)bmalloc(sizeof(VIEW));
925 <        copystruct(vwl[currentview].v, &thisview);
925 >        *(vwl[currentview].v) = thisview;
926          if (nm != NULL)
927                  vwl[currentview].nam = savqstr(nm);
928   }
929  
930  
931 < copylastv(cause)                        /* copy last view position */
932 < char    *cause;
931 > static void
932 > copylastv(                      /* copy last view position */
933 >        char    *cause
934 > )
935   {
936          static char     *lastvc;
937  
938          if (cause == lastvc)
939                  return;                 /* only record one view per cause */
940          lastvc = cause;
941 <        copystruct(&lastview, &thisview);
941 >        lastview = thisview;
942   }
943  
944  
945 < fixwindow(eexp)                         /* repair damage to window */
946 < register XExposeEvent  *eexp;
945 > static void
946 > fixwindow(                              /* repair damage to window */
947 >        XExposeEvent  *eexp
948 > )
949   {
950 <        if (hres == 0 | vres == 0) {    /* first exposure */
950 >        if ((hres == 0) | (vres == 0)) {        /* first exposure */
951                  resizewindow((XConfigureEvent *)eexp);
952                  return;
953          }
# Line 873 | Line 958 | register XExposeEvent  *eexp;
958   }
959  
960  
961 < resizewindow(ersz)                      /* resize window */
962 < register XConfigureEvent  *ersz;
961 > static void
962 > resizewindow(                   /* resize window */
963 >        XConfigureEvent  *ersz
964 > )
965   {
966          static char     resizing[] = "resizing window";
967          double  wa, va;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines