http://ftp.aanet.ru/pub/Linux/X11/apps/xscreensaver-2.31.tar.gz
authorZygo Blaxell <zblaxell@hungrycats.org>
Mon, 2 Mar 2009 05:42:27 +0000 (00:42 -0500)
committerZygo Blaxell <zblaxell@hungrycats.org>
Mon, 2 Mar 2009 05:42:27 +0000 (00:42 -0500)
-rw-r--r-- 1 zblaxell zblaxell 909790 Oct  5  1998 xscreensaver-2.31.tar.gz
8f1e9e985d8aa22613fd3388b3a161edd8270d25  xscreensaver-2.31.tar.gz

182 files changed:
Makefile.in
README
README.debugging
config.h.in
configure
configure.in
driver/Makefile.in
driver/XScreenSaver.ad.in
driver/XScreenSaver_ad.h
driver/demo.c
driver/dialogs-Xaw.c
driver/dialogs-Xm.c
driver/dialogs.xd
driver/kpasswd.c
driver/lock.c
driver/passwd.c
driver/setuid.c [new file with mode: 0644]
driver/splash.c [new file with mode: 0644]
driver/stderr.c
driver/subprocs.c
driver/test-passwd.c [new file with mode: 0644]
driver/test-uid.c [new file with mode: 0644]
driver/timers.c
driver/windows.c
driver/xscreensaver-command.c
driver/xscreensaver-command.man
driver/xscreensaver.c
driver/xscreensaver.h
driver/xscreensaver.man
driver/xset.c
hacks/Makefile.in
hacks/ant.c
hacks/attraction.c
hacks/attraction.man
hacks/blitspin.c
hacks/blitspin.man
hacks/bouboule.c
hacks/bouboule.man
hacks/braid.c
hacks/braid.man
hacks/bsod.c
hacks/bubbles-default.c
hacks/coral.c
hacks/crystal.c
hacks/cynosure.c
hacks/decayscreen.c
hacks/deco.c
hacks/deco.man
hacks/distort.c
hacks/drift.c
hacks/drift.man
hacks/epicycle.man
hacks/flag.c
hacks/flag.man
hacks/flame.c
hacks/flame.man
hacks/forest.man
hacks/galaxy.c
hacks/galaxy.man
hacks/glx/Makefile.in
hacks/glx/atlantis.c
hacks/glx/atlantis.h
hacks/glx/bubble3d.c [new file with mode: 0644]
hacks/glx/cage.c
hacks/glx/dolphin.c
hacks/glx/lament.c [new file with mode: 0644]
hacks/glx/lament.man [new file with mode: 0644]
hacks/glx/shark.c
hacks/glx/swim.c
hacks/glx/whale.c
hacks/glx/xlock-gl.c
hacks/goop.c
hacks/goop.man
hacks/grav.c
hacks/grav.man
hacks/greynetic.c
hacks/greynetic.man
hacks/halo.c
hacks/halo.man
hacks/helix.c
hacks/helix.man
hacks/hopalong.c
hacks/hopalong.man
hacks/hypercube.c
hacks/hypercube.man
hacks/ifs.c
hacks/ifs.man
hacks/images/atari.xbm [new file with mode: 0644]
hacks/images/lament.xpm [new file with mode: 0644]
hacks/imsmap.man
hacks/interference.c
hacks/jigsaw.c
hacks/jigsaw.man
hacks/julia.c
hacks/julia.man
hacks/kumppa.c
hacks/laser.c
hacks/laser.man
hacks/lightning.c
hacks/lightning.man
hacks/lisa.man
hacks/lmorph.man
hacks/maze.c
hacks/moire.c
hacks/moire.man
hacks/moire2.c
hacks/munch.c
hacks/noseguy.c
hacks/noseguy.man
hacks/penrose.c
hacks/penrose.man
hacks/pyro.c
hacks/pyro.man
hacks/qix.c
hacks/qix.man
hacks/rd-bomb.c
hacks/rocks.c
hacks/rocks.man
hacks/rorschach.c
hacks/rorschach.man
hacks/screenhack.c
hacks/screenhack.h
hacks/sierpinski.c
hacks/sierpinski.man
hacks/slidescreen.c
hacks/slidescreen.man
hacks/slip.c
hacks/slip.man
hacks/sphere.c
hacks/sphere.man
hacks/spiral.c
hacks/spiral.man
hacks/starfish.c
hacks/starfish.man
hacks/strange.c
hacks/strange.man
hacks/swirl.c
hacks/swirl.man
hacks/vidwhacker
hacks/vines.c
hacks/vines.man
hacks/xjack.c
hacks/xjack.man
hacks/xlockmore.c
hacks/xlockmore.h
hacks/xlockmoreI.h
hacks/xlyap.c
hacks/xroger-hack.c
hacks/xroger.man
hacks/xscreensaver-sgigl.c
utils/Makefile.in
utils/alpha.c
utils/alpha.h
utils/colors.c
utils/colors.h
utils/compile_axp.com
utils/compile_decc.com
utils/erase.c
utils/fade.c
utils/fade.h
utils/grabscreen.c
utils/grabscreen.h
utils/hsv.c
utils/hsv.h
utils/overlay.c
utils/resources.c
utils/resources.h
utils/sgivideo.c
utils/sgivideo.h
utils/usleep.c
utils/usleep.h
utils/utils.h
utils/version.h
utils/visual.c
utils/visual.h
utils/xmu.c
utils/xroger.c
utils/xshm.c [new file with mode: 0644]
utils/xshm.h [new file with mode: 0644]
utils/yarandom.h
xscreensaver.lsm
xscreensaver.lsm.sh

index 8638d53606ced959873206d1be0a69b289b7be47..2127292bc0c7d0a1a7acfbaeed2015dd0543fc2e 100644 (file)
@@ -12,13 +12,13 @@ TARFILES    = README README.VMS README.debugging INSTALL xscreensaver.lsm \
                  config.h-vms install-sh setup.com config.guess \
                  config.sub makevms.com screenblank.txt \
                  xscreensaver.lsm.sh
-TAR            = gtar
+TAR            = tar
 COMPRESS       = gzip --verbose --best
 COMPRESS_EXT   = gz
 # COMPRESS     = compress
 # COMPRESS_EXT = Z
 
-MAKE_SUBDIR    = for dir in $(SUBDIRS) ; do ( cd $$dir ; $(MAKE) $@ ) ; done
+MAKE_SUBDIR = for dir in $(SUBDIRS); do (cd $$dir; $(MAKE) $@) || exit 5; done
 
 all::
        @$(MAKE_SUBDIR)
@@ -46,7 +46,7 @@ tags:
 clean:
        @$(MAKE_SUBDIR)
 distclean: clean
-       -rm -f config.h Makefile config.status config.cache config.log *~ "#"*
+       -rm -f config.h Makefile config.status config.cache config.log TAGS *~ "#"*
        @$(MAKE_SUBDIR)
 
 dist: tar
@@ -55,7 +55,8 @@ dist: tar
 tar:
        @                                                                   \
   sh config.status ;                                                       \
-  $(MAKE) hack_configure ;                                                 \
+  rm -f configure ;                                                        \
+  $(MAKE) configure ;                                                      \
   $(MAKE) distdepend ;                                                     \
   sh xscreensaver.lsm.sh > xscreensaver.lsm.$$$$ ;                         \
   mv xscreensaver.lsm.$$$$ xscreensaver.lsm ;                              \
@@ -85,7 +86,7 @@ tar:
 # out options we don't use.  Odds are good that this will fail with any version
 # of autoconf other than 2.12.
 #
-hack_configure::
+configure::
        autoconf
        @TMP=configure.$$$$ ;                                                \
        echo "munging configure's --help message..." ;                       \
@@ -108,7 +109,6 @@ hack_configure::
                s/--enable and --with options recognized://m;                \
                s/\n  --with-x .*?(["\n])/$$1/s;                             \
                s/\n(Installation options:\n)/$$1/s;                         \
-               s/\n(X Server Extension options:\n)/$$1/s;                   \
                                                                             \
                s/^  --oldincludedir=.*$$/ \
  --x-includes=DIR        X include files are in DIR\n \
@@ -119,3 +119,76 @@ hack_configure::
        > $$TMP &&                                                           \
        cat $$TMP > configure ) ;                                            \
        rm -f $$TMP
+
+bump-version::
+       @                                                                   \
+  SRC=utils/version.h ;                                                            \
+  VERS=`sed -n 's/[^0-9]*\([0-9]\)\.\([0-9][0-9]*\).*/\1 \2/p' $$SRC` ;            \
+  set - $$VERS ;                                                           \
+  MAJOR="$$1"; MINOR="$$2";                                                \
+  NEW=`echo $$MINOR + 1 | bc` ;                                                    \
+  D=`date '+%d-%b-%y'`;                                                            \
+  if [ ! -f xscreensaver-$$MAJOR.$$MINOR.tar.gz ]; then                            \
+    echo "WARNING: xscreensaver-$$MAJOR.$$MINOR.tar.gz does not exist.";    \
+  fi ;                                                                     \
+  if [ -f xscreensaver-$$MAJOR.$$NEW.tar.gz ]; then                        \
+    echo "WARNING: xscreensaver-$$MAJOR.$$NEW.tar.gz already exists.";     \
+  fi ;                                                                     \
+  echo -n "Bumping $$MAJOR.$$MINOR to $$MAJOR.$$NEW ($$D), ok? ";          \
+  read line;                                                               \
+  if [ "x$$line" != "xyes" -a  "x$$line" != "xy" ]; then                   \
+    exit 1 ;                                                               \
+  fi ;                                                                     \
+  TMP=/tmp/bv.$$ ;                                                         \
+  sed -e "s/\([0-9]\.[0-9][0-9]*\)/$$MAJOR.$$NEW/"                         \
+      -e "s/\(([0-9][0-9]*-[A-Za-z][a-z][a-z]-[0-9][0-9][0-9]*\))/($$D)/"   \
+        $$SRC > $$TMP ;                                                            \
+  echo -n "New version and date are ";                                     \
+  sed -n "s/[^0-9]*\([0-9]\.[0-9][0-9]*\) (\([-A-Za-z0-9]*\)).*/\1, \2./p"  \
+     $$TMP;                                                                \
+  cat $$TMP > $$SRC ;                                                      \
+  rm -f $$TMP;                                                             \
+  echo "overwrote $$SRC";                                                  \
+  ls -lFd $$SRC
+
+www::
+       @                                                                   \
+  DEST=$$HOME/www/xscreensaver ;                                           \
+  VERS=`sed -n 's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/\1/p' utils/version.h` ;  \
+  NAME="xscreensaver-$$VERS.tar.gz" ;                                      \
+  if [ ! -f $$NAME ]; then                                                 \
+    echo "$$NAME does not exist!  Did you forget to \`make tar'?" ;        \
+    exit 1 ;                                                               \
+  fi ;                                                                     \
+  if [ -f $$DEST/$$NAME ]; then                                                    \
+    echo -n "WARNING: $$DEST/$$NAME already exists!  Overwrite? ";         \
+    read line;                                                     \
+    if [ "x$$line" != "xyes" -a "x$$line" != "xy" ]; then                  \
+      exit 1 ;                                                                     \
+    fi ;                                                                   \
+  fi ;                                                                     \
+  cp -p $$NAME $$DEST/$$NAME ;                                             \
+  chmod u+w $$DEST/$$NAME ;                                                \
+  cd $$DEST ;                                                              \
+                                                                           \
+  TMP=/tmp/xd.$$$$ ;                                                       \
+  sed "s/xscreensaver-[0-9]\.[0-9][0-9]\.tar\.gz/$$NAME/g" index.html      \
+    > $$TMP ;                                                              \
+  echo '' ;                                                                \
+  diff -u0 index.html $$TMP ;                                              \
+  echo '' ;                                                                \
+                                                                           \
+  OLDEST=`ls xscreensaver*.tar.gz | head -1` ;                             \
+  echo -n "Delete $$DEST/$$OLDEST? ";                                      \
+  read line;                                                               \
+  if [ "x$$line" = "xyes" -o "x$$line" = "xy" ]; then                      \
+    set -x ;                                                               \
+    rm $$OLDEST ;                                                          \
+    cvs remove $$OLDEST ;                                                  \
+  else                                                                     \
+    set -x ;                                                               \
+  fi ;                                                                     \
+  cvs add -kb $$NAME ;                                                     \
+  cat $$TMP > index.html ;                                                 \
+  rm -f $$TMP ;                                                                    \
+  cvs commit -m "$$VERS"
diff --git a/README b/README
index e024874ef01194d3b0caef3e539ebd1021444b01..70ddfda5d2dba294f6b59b8b321e5f3ceb778212 100644 (file)
--- a/README
+++ b/README
@@ -4,6 +4,8 @@
             a screen saver and locker for the X window system
                             by Jamie Zawinski
 
+                     http://www.jwz.org/xscreensaver/
+
 To build on Unix:
 
   -  ./configure
@@ -18,13 +20,14 @@ The file `INSTALL' gives a general overview of use of these sorts of
 configure scripts (those generated by the GNU autoconf system.)
 The most important hint is probably this:
 
-   ./configure --includedir=/opt/Motif/include --libdir=/opt/Motif/lib
+     ./configure --with-motif=/opt/Motif --with-xpm=/usr/local
 
 To build on VMS, see README.VMS.
 
-If you think you've found a bug, please let me know; but first, read
-the enlosed `README.debugging' file to find out what kind of information
-would be most helpful to include in your bug report.
+If you think you've found a bug, please let me know!  No bug report is too
+small.  But first, please read the enclosed `README.debugging' file to find
+out what kind of information would be most helpful to include in your bug
+report.
 
 Getting Started:
 
@@ -44,151 +47,79 @@ xscreensaver has an extensive manual -- please read it!
 
                               ============
 
-The xscreensaver program waits until the keyboard and mouse have been idle
-for a period, and then runs a graphics demo chosen at random.  It turns off
-as soon as there is any mouse or keyboard activity.
-
-The purpose of xscreensaver is to display pretty pictures on your screen
-when it is not in use, in keeping with the philosophy that unattended
-monitors should always be doing something interesting, just like they do
-in the movies.
-
-However, xscreensaver can also be used as a screen locker, to prevent
-others from using your terminal while your are away.
-
-The benefit that this program has over the combination of the xlock and
-xautolock programs is the ease with which new graphics hacks can be
-installed: you don't need to recompile this program to add a new display
-mode, you just change some resource settings.  Any program which can be
-invoked in such a way that it draws on the root window of the screen can
-now be used as a screensaver without modification.  The programs that
-are being run as screensavers don't need to have any special knowledge
-about what it means to be a screensaver.
-
-The XIDLE, MIT-SCREEN-SAVER, and/or SGI SCREEN_SAVER server extensions
-will be used if you have them.
-
-The dialog boxes (for locking and demo-mode) look best using Motif or
-Lesstif, but can be configured to use Athena widgets instead.
+The xscreensaver daemon waits until the keyboard and mouse have been idle
+for a period, and then runs a graphics demo chosen at random.  The demo is
+terminated as soon as there is any mouse or keyboard activity (or, in
+locking mode, when the proper password is typed.)
 
-Also included are numerous graphics hacks for use as screensavers.  There's
-nothing magic about these: they're just programs that draw on the root
-window, which are pointed at by the screensaver's default resource settings.
+It is trivially easy to add new display modes to xscreensaver: any program
+which can be invoked in such a way that it draws on the root window of the
+screen can be used as a screensaver.  You just change a resource setting --
+there's no need to recompile or reinstall anything.
 
-   qix         - My own implementation of this, with many more options
-                 than you would have thought qix could have.
-   helix       - Generates spirally "stringart" patterns.
-   pedal       - Draws a different kind of spirally pattern.
-   rorschach   - Random inkblot patterns.
-   attraction  - A bouncing ball demo, or a qix-like demo, or a wild
-                 color-cycling thing, with some odd rules.
-   greynetic   - Random colored/stippled rectangles.
-   rocks       - Flying through an asteroid field.
-   blitspin    - Rotate a bitmap using bitblts.
-   imsmap      - Generates random maps or cloud formations.
-   hypercube   - 2d projection of a hypercube rotating on all four axes.
-   slidescreen - Divides the screen into a grid and plays a 16-puzzle on it.
-   decayscreen - A melting effect.
-   jigsaw      - Turns the screen into a jigsaw puzzle and shuffles it.
-   halo                - Random circular patterns.
-   pyro                - Fireworks.  Looks a lot like the version in xlock.
-   hopalong    - Fractals.  I snarfed this code from xlock.
-   flame       - Fractals.  Also from xlock.
-   noseguy     - A guy with a big nose wanders around the screen saying
-                 things.  I snarfed this code from xnlock.
-   maze                - This is the X maze demo modified to take a -root option
-                 so that it works with xscreensaver.
-   lmorph      - morphing line drawings.
-   bubbles     - condensation forms on your monitor, then pops.
-   deco                - Generates Brady-Bunch-era wall paneling.
-   moire       - Circular interference patterns.
-   moire2      - More moire.
-   kaleidescope        - Groovy, man.
-   swirl       - Swirly color-cycling patterns.
-   bouboule    - Spinning bubbles on a transparent ball.
-   braid       - Draws random color-cycling braids around a circle.
-   drift       - Drifting recursive fractal cosmic flames.
-   vines       - Small, curvy geometric patterns.
-   galaxy      - Spinning, colliding galaxies.
-   grav                - Orbital simulation and/or cloud chamber.
-   ifs         - Spinning, colliding iterated-function-system shapes.
-   julia       - Animated rendition of the Julia set.
-   laser       - Moving radiating lines.
-   lightning   - Crackling fractal lightning bolts.
-   penrose     - Quasiperiodic tilings.
-   sierpinski  - two-dimensional Sierpinski triangle.
-   slip                - Sucks your desktop through a jet engine.
-   spiral      - Circular color-cycling interference patterns.
-   strange     - Animating strange attractors.
-   flag                - A waving flag of an arbitrary bitmap or text.
-   sphere      - Draws a bunch of shaded spheres.
-   forest      - grows a fractal forest.
-   lisa                - draws animated full-loop lisajous figures.
-   lissie      - another lisajous path.
-   goop                - Squishy transparent oil-and-bubble images
-   starfish    - Radially-symmetric throbbing colormap-hacking blobs.
-   munch       - The classic 1962-vintage "munching squares" hack.
-   rd-bomb      - Reaction-diffusion fractals.
-   coral        - Simulation of coral growth, sort of.
-   fadeplot    - Draws a swimming ribbon.
-   mountain    - Generates mountains on a square grid.
-   triangle    - Generates mountains on a triangular grid.
-   worm                - Draws wiggly worms.
-   rotor       - Draws a rotating spiral pattern.
-   ant         - A cellular automaton.
-   xjack       - Simulates a schizophrenic typist.
-   xlyap       - Calculates and displays Lyapunov exponents.
-   flow                - More strange attractors.
-   epicycle    - Spiral patterns based on pre-Copernican cosmologies.
-   interference        - More groovy colored fields.
-   truchet     - Nonrepeating planar tilings.
-   bsod                - Simulates the system crashes of various other OSes.
-   crystal     - A kaleidoscope of moving polygons.
-   discrete    - Various fractal-ish "discrete map" forms.
-   distort     - A moving lens wanders around the screen, magnifying it.
-   kumppa      - Spinning 3D color fields, kinda.
-   gears       - Draws interlocking rotating gears (GLX only.)
-   morph3d     - Draws shiny shape-changing 3d forms (GLX only.)
-   superquadrics - More shiny shape-changing 3d forms (GLX only.)
-   pipes       - Generates a field of intertwined plumbing (GLX only.)
-   rubik       - Solves a Rubik's Cube (GLX only.)
-   sproingies  - Marble Madness meets Q-Bert (GLX only.)
-   stairs      - Draws Escher's infinite staircase (GLX only.)
-   cage                - Draws Escher's impossible cage (GLX only.)
-   moebius     - Draws Escher's Moebius Strip II (GLX only.)
-   atlantis    - Draws swimming mammals (GLX only.)
-
-All of these will pop up their own window unless given that -root option.
-See their respective man pages for more details.
-
-Other reasonable things to use as screensavers, if you have them, are
+                              ============
 
-  xdaliclock -root -builtin2   - melting digital clock
-  xswarm -r 2>&-               - swimming sperm
-  xwave -root                  - random 3d graphs
-  xbouncebits                  - bounce arbitrary bitmaps around
-  ico -r -p8 -faces -sleep 1   - it's dull, but it's there
-  xv -root file.gif -quit      - they don't all have to animate!
-  xsplinefun                   - bouncing splines
-  xfishtank -c black -d -r 1   - fish (use version 2.0 or later)
-  xmountains -b                        - very realistic generated mountains
-  xtacy -root                  - various eye candy
-  xearth -wait 0 -timewarp 400 - the earth as seen from space
-  /usr/demos/bin/bongo         - an SGI GL demo
-  /usr/demos/bin/ep -S         - another: the stunning ElectroPaint.
-                                 (Compile hacks/xscreensaver-sgigl.c
-                                 to use these with xscreensaver.)
+Along with the xscreensaver daemon itself, this package also includes
+numerous graphics hacks for use as screensavers.  There is nothing magic
+about these: they are just programs that draw on the root window.
 
-You can get most of these from the contrib directory on ftp.x.org.  If you
-know of (or write) any other interesting programs that can be used as
-screensavers, please let me know!
+More than 80 such programs are included.  For details, see the xscreensaver
+web page, or the enclosed manual pages.  There are also some helpful hints
+on customization in the xscreensaver app-defaults file (normally installed
+in /usr/lib/X11/app-defaults/XScreenSaver.)
 
 The latest version of xscreensaver is always available on the web at
-http://people.netscape.com/jwz/xscreensaver/.
+http://www.jwz.org/xscreensaver/.
 
-       -- Jamie Zawinski <jwz@netscape.com>
+                              ============
 
-\f
+Changes since 2.30:   * The cursor was invisible in the password dialog. Fixed.
+                     * Made configure warn against MesaGL 2.6.
+                     * Fixed X error at startup when using non-default visual.
+                     * New version of `crystal', `ant', and `atlantis' from
+                       xlockmore.
+                     * New hack, `bubble3d'.
+                     * Added some new modes to `bsod'.
+Changes since 2.29:   * Changed the order in which -lSM and -lICE are linked
+                       to be after Motif instead of before (Lesstif on Irix
+                       needs this.)
+Changes since 2.28:   * Work around a bash bug in configure.
+                     * Tweaked HPUX paths again.  FTSOHPUX.
+                     * Made configure recommend against LessTif 0.86, due
+                       to a bug in that version that causes a security hole
+                       in the screen locking code.  LessTif 0.87 will fix it.
+                     * Made all of the `--with' options to `configure' accept
+                       a directory option as well (so that --with-motif=/FOO
+                       will add -I/FOO/include -L/FOO/lib).  I believe this is
+                       the Configure Party Line of how do to such things.
+                     * Fixed a bug where the mouse was left un-grabbed
+                       after the first time the graphics hack was changed
+                       (simplified all of the mouse-grabbing logic.)
+                     * Maybe possibly perhaps made `vidwhacker' really not
+                       leave stray xv windows around.  This time for sure.
+                     * Added a new erase mode (random dots fizzling out.)
+                     * Added `-prefs' argument to `xscreensaver-command',
+                       that brings up the Preferences dialog directly (it
+                       seems that nobody ever noticed the `Preferences' button
+                       on the Demo Mode dialog, maybe this will help.)
+                     * Added a splash screen.  Turn it off with *splash:false.
+Changes since 2.27:   * Better macsbug text in `bsod'.
+                     * New version of `distort' with many new modes.
+                     * Plugged a leak in `coral'.
+                     * Tweaked configure for HPUX.
+                     * Removed some compiler warnings.
+                     * More consistent usage of stderr versus stdout.
+                     * More diagnostics should an X error occur.
+                     * Fixed a possible crash in SGI-specific unfading code.
+Changes since 2.26:   * Improved version of `distort'.
+                     * Made `lament' compile against OpenGL 1.0 (though it
+                       still requires 1.1 to work properly.)
+                     * Updated my email address and home page.
+Changes since 2.24:   * Improved motion in `rd-bomb'.
+                     * Added XSHM (shared memory extension) support to the
+                       `distort', `interference', `moire', `rd-bomb', and
+                       `swirl' hacks, which speeds them up a bit.
+                     * Added `lament' hack.
 Changes since 2.23:   * Tweaked the order of the -L options again.
                      * Cleaned up configure's --help message.
                      * Added `kumppa' hack.
index b7e7fe0bb6bd554dc0d7e9c7e9bffdc9be946bba..87ebb4d29d8f631bbc67cfc0978d2f957a1a9b47 100644 (file)
@@ -9,10 +9,10 @@
     document gives some hints for isolating them; the more information
     you can give me about the problem, the better the odds that I'll be
     able to fix it.  But, if you don't have time to go through these
-    steps, report the bug anyway -- even vague bug reports can be 
+    steps, report the bug anyway -- even vague bug reports can be
     better than no bug report at all.
-                                --------
 
+                                --------
 STEP ZERO:
 
     What are you doing here?  Go read README, and then the man page.
@@ -20,7 +20,7 @@ STEP ZERO:
 STEP ZERO, PART TWO:
 
     Do you have the most recent version?  Go make sure.
-    http://people.netscape.com/jwz/xscreensaver/
+    http://www.jwz.org/xscreensaver/
 
 BUILDING:
 
@@ -59,17 +59,20 @@ BUILDING:
     problem is that you don't have some kind of ``development option''
     installed.  Xt/ and Xaw/ (Athena) are free and available on all
     systems; Xm/ (Motif) is available on all commercial systems except
-    SunOS 4.x and some early releases of Solaris.
+    SunOS 4.x and some early releases of Solaris.  For Linux and other
+    free Unixes systems, a Motif clone is available from
+    http://www.lesstif.org/.
 
 RUNNING:
 
     For runtime errors, it's important to keep in mind that there are
     two parts to xscreensaver: there is the screensaver driver process
-    (the part that detects idleness, deals with locking, and launches
+    (the daemon that detects idleness, deals with locking, and launches
     the demos); and there are the demos themselves (independent programs
     that draw pretty pictures.)
 
-        *  Compile with `make CFLAGS=-g'.
+        *  Compile with `make CFLAGS=-g' (so that if you get a core
+          dump, there will be debugging info in it.)
 
         *  What platform are you running on?  What does the included
            `./config.guess' shell script print?
@@ -77,7 +80,7 @@ RUNNING:
         *  Is the problem in the driver, or in the graphics hacks?
 
         *  If the problem is in the driver, was the driver built using
-           Motif, or Athena?  Which version?
+           Motif, Lesstif, or Athena?  Which version?
 
         *  If the problem is in one (or more) of the hacks, which ones?
            If you're not sure, try
@@ -88,10 +91,10 @@ RUNNING:
            don't.
 
         *  Does the problem occur when running that hack by hand, in
-           its own window?
+           its own window (i.e., when started with no command-line args)?
 
         *  Does the problem occur when running that hack by hand, on
-           the root window (the `-root' option)?
+           the root window (i.e., when started with the `-root' option)?
 
         *  IMPORTANT: What visual are you using?  Send the output of
            the `xdpyinfo' command.
@@ -108,10 +111,11 @@ RUNNING:
            program under a debugger, and show me the stack trace.
            (If you don't know how to do that, that's ok.)
 
-        *  If it gets an X error, where did it come from?  Run the
-           program under a debugger; set a breakpoint on `exit';
-           start the program with the `-sync' command-line option;
-           and show me the stack trace when it stops.
+        *  If it gets an X error, where did it come from?  Run
+           xscreensaver with the `-sync' command-line option; if -sync
+           is used, then X errors will cause xscreensaver to dump a core
+           file.  Look at the core file with a debugger and show me the
+           stack trace: were in xscreensaver did that X error come from?
 
     If the problem is with the xscreensaver process itself, or if you
     can't figure out which demo is causing the problem, or if you can't
@@ -128,18 +132,24 @@ RUNNING:
            prevent the data from being displayed on the screensaver
            window as well.
 
-           You also might want to set the "*timestamp" resource to True, which
-           will cause the xscreensaver messages to include the time at which
+           You also might want to use the `-timestamp' option, which will
+           cause the xscreensaver messages to include the time at which
            they were printed.
 
         *  If the problem is intermittent, you might want to capture the
-           log information to a file and examine it later.
+           log information to a file and examine it later.  For example,
+           you could start it from your login script like this (csh syntax):
+
+             ( cd ~/src/xscreensaver/ ; \
+               xscreensaver -sync -verbose -timestamp \
+               -xrm '*captureStderr:false' -xrm '*captureStdout:false' \
+               >>&LOG & )
 
         *  Hackers only: If you're feeling adventurous enough to run gdb
            on the xscreensaver driver process itself, make sure you've
            read the commentary at the top of xscreensaver.c.
 
 -----------------------------------------------------------------------------
-                                 http://people.netscape.com/jwz/xscreensaver/
-                                            Jamie Zawinski <jwz@netscape.com>
+                                             http://www.jwz.org/xscreensaver/
+                                                 Jamie Zawinski <jwz@jwz.org>
 -----------------------------------------------------------------------------
index 4ee2cd7a66fa7192cc258ec816ebd153af262e49..98e6a91ba621eea9a9f64f04d222b9ab654142b1 100644 (file)
  */
 #undef HAVE_GL
 
-/*  Define this if you have GL, but it's the MesaGL variant.  (The libraries
-    have different names.)  (HAVE_GL should be defined too.)
+/*  Define this if you have OpenGL, but it's the MesaGL variant.  (The 
+    libraries have different names.)  (HAVE_GL should be defined too.)
  */
 #undef HAVE_MESA_GL
 
+/*  Define this if your version of OpenGL has the glBindTexture() routine.
+    This is the case for OpenGL 1.1, but not for OpenGL 1.0.
+ */
+#undef HAVE_GLBINDTEXTURE
+
 /*  Define this if you have the X Shared Memory Extension.
  */
 #undef HAVE_XSHM_EXTENSION
index 88a0de6570453ecc62753edfdf1f39e64ca3a7ed..d35d97733fb5dc06752a1ca8cf33a2805874a564 100755 (executable)
--- a/configure
+++ b/configure
@@ -26,6 +26,11 @@ Installation options:
 "
 ac_help="$ac_help"
 ac_help="$ac_help
+Except where noted, all of the --with options below can also take a
+directory argument: for example, --with-motif=/opt/Motif.  That would
+cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
+to be added to the -L list, assuming those directories exist.
+
 X Server Extension options:
 
   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
@@ -55,8 +60,8 @@ ac_help="$ac_help
 
 X Client Toolkit options:
 
-  --with-motif            Use the Motif toolkit for the user interface,
-                          if possible (this is the default).
+  --with-motif            Use the Motif toolkit for the user interface, if
+                          possible (this is the default).
   --without-motif         Do not use Motif."
 ac_help="$ac_help
   --with-athena           Use the Athena toolkit for the user interface, if
@@ -630,7 +635,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:646: checking host system type" >&5
+echo "configure:650: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -654,7 +659,7 @@ echo "$ac_t""$host" 1>&6
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:670: checking for $ac_word" >&5
+echo "configure:674: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -683,7 +688,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:699: checking for $ac_word" >&5
+echo "configure:703: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -731,7 +736,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:747: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:751: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -741,11 +746,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 757 "configure"
+#line 761 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -765,12 +770,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:781: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:786: checking whether we are using GNU C" >&5
+echo "configure:790: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -779,7 +784,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:795: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -794,7 +799,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:810: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:814: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -824,7 +829,7 @@ fi
 
 if test -z "$GCC"; then
   echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6
-echo "configure:840: checking how to request ANSI compilation" >&5
+echo "configure:844: checking how to request ANSI compilation" >&5
   case "$host" in
     *-hpux*)
       echo "$ac_t""HPUX: adding -Ae" 1>&6
@@ -835,8 +840,10 @@ echo "configure:840: checking how to request ANSI compilation" >&5
       CC="$CC -qlanglvl=ansi -qhalt=e"
     ;;
 
-# NOTE:   for Digital, need to add -std1 to get ANSI, but I'm not sure
-#         yet what $host pattern we should be testing for...
+    *-dec-*)
+      echo "$ac_t""DEC: adding -std1" 1>&6
+      CC="$CC -std1"
+    ;;
 
     *)
       echo "$ac_t""no idea" 1>&6
@@ -846,16 +853,16 @@ fi
 
 
 echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6
-echo "configure:862: checking whether the compiler works on ANSI C" >&5
+echo "configure:868: checking whether the compiler works on ANSI C" >&5
 if test "$cross_compiling" = yes; then
   { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 867 "configure"
+#line 873 "configure"
 #include "confdefs.h"
  main(int ac, char **av) { return 0; } 
 EOF
-if { (eval echo configure:871: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""yes" 1>&6
 else
@@ -871,20 +878,40 @@ fi
 
 case "$host" in
   *-irix*)
-  if test -n "$GCC"; then
-    echo "$ac_t""Turning on gcc compiler warnings." 1>&6
-    CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
-  else
-    # not gcc
-    echo "$ac_t""Turning on SGI compiler warnings." 1>&6
-    CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
-  fi
+    if test -n "$GCC"; then
+      echo "$ac_t""Turning on gcc compiler warnings." 1>&6
+      CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
+    else
+      # not gcc
+      echo "$ac_t""Turning on SGI compiler warnings." 1>&6
+      CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
+    fi
+  ;;
+
+    *-linux-*)
+      echo "$ac_t""Turning on gcc compiler warnings." 1>&6
+      CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
   ;;
+
+#  *-dec-osf*)
+#    if test -z "$GCC"; then
+#      AC_MSG_RESULT(Turning on DEC C compiler warnings.)
+#      CC="$CC -migrate -w0 -verbose -warnprotos"
+#    fi
+#  ;;
+
 esac
 
 
+# Try and determine whether ${INSTALL} can create intermediate directories,
+# and if not, whether "mkdir -p" works instead.  This sets ${INSTALL_DIRS}.
+# (But autoconf should earn its keep and do this for us!)
+#
+
+
+
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:900: checking how to run the C preprocessor" >&5
+echo "configure:926: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -899,13 +926,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 915 "configure"
+#line 941 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -916,13 +943,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 932 "configure"
+#line 958 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -955,7 +982,7 @@ echo "$ac_t""$CPP" 1>&6
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:971: checking for a BSD compatible install" >&5
+echo "configure:997: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1004,8 +1031,35 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
+INSTALL_DIRS='${INSTALL} -d'
+   echo $ac_n "checking whether \"\${INSTALL} -d\" creates intermediate directories""... $ac_c" 1>&6
+echo "configure:1048: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5
+   rm -rf conftestdir
+   if mkdir conftestdir; then
+      cd conftestdir >&-
+
+      ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
+      if test -d dir1/dir2 ; then
+        echo "$ac_t""yes" 1>&6
+      else
+        echo "$ac_t""no" 1>&6
+        echo $ac_n "checking whether \"mkdir -p\" creates intermediate directories""... $ac_c" 1>&6
+echo "configure:1059: checking whether \"mkdir -p\" creates intermediate directories" >&5
+        rm -rf dir1
+        mkdir -p dir1/dir2 >&- 2>&-
+        if test -d dir1/dir2/. ; then
+         echo "$ac_t""yes" 1>&6
+         INSTALL_DIRS='mkdir -p'
+        else
+         echo "$ac_t""no" 1>&6
+        fi
+      fi
+      cd .. >&-
+      rm -rf conftestdir
+   fi
+
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1021: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1074: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1033,12 +1087,12 @@ fi
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1049: checking for working const" >&5
+echo "configure:1102: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1054 "configure"
+#line 1107 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1087,7 +1141,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1156: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1108,21 +1162,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1124: checking for inline" >&5
+echo "configure:1177: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 1131 "configure"
+#line 1184 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1138: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -1149,12 +1203,12 @@ esac
 
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1165: checking for ANSI C header files" >&5
+echo "configure:1218: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1170 "configure"
+#line 1223 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1162,7 +1216,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1231: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1179,7 +1233,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1195 "configure"
+#line 1248 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1197,7 +1251,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1213 "configure"
+#line 1266 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1218,7 +1272,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1234 "configure"
+#line 1287 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1229,7 +1283,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1253,12 +1307,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1269: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1322: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1274 "configure"
+#line 1327 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -1267,7 +1321,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1336: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -1288,12 +1342,12 @@ EOF
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1304: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1357: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1309 "configure"
+#line 1362 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1309,7 +1363,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1378: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -1334,12 +1388,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1350: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1403: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1355 "configure"
+#line 1408 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -1347,7 +1401,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:1363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -1372,7 +1426,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1388: checking for opendir in -ldir" >&5
+echo "configure:1441: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1380,7 +1434,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1396 "configure"
+#line 1449 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1391,7 +1445,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1460: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1413,7 +1467,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1429: checking for opendir in -lx" >&5
+echo "configure:1482: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1421,7 +1475,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1437 "configure"
+#line 1490 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1432,7 +1486,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:1448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1456,12 +1510,12 @@ fi
 
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1472: checking for mode_t" >&5
+echo "configure:1525: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1477 "configure"
+#line 1530 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1489,12 +1543,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1505: checking for pid_t" >&5
+echo "configure:1558: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1510 "configure"
+#line 1563 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1522,12 +1576,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1538: checking for size_t" >&5
+echo "configure:1591: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1543 "configure"
+#line 1596 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1555,12 +1609,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1571: checking return type of signal handlers" >&5
+echo "configure:1624: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1576 "configure"
+#line 1629 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1577,7 +1631,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1597,12 +1651,12 @@ EOF
 
 
 echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6
-echo "configure:1613: checking how to call gettimeofday" >&5
+echo "configure:1666: checking how to call gettimeofday" >&5
 if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1618 "configure"
+#line 1671 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                  #include <sys/time.h>
@@ -1611,7 +1665,7 @@ struct timeval tv; struct timezone tzp;
                  gettimeofday(&tv, &tzp);
 ; return 0; }
 EOF
-if { (eval echo configure:1627: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1680: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_gettimeofday_args=2
 else
@@ -1619,7 +1673,7 @@ else
   cat conftest.$ac_ext >&5
   rm -rf conftest*
   cat > conftest.$ac_ext <<EOF
-#line 1635 "configure"
+#line 1688 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                                  #include <sys/time.h>
@@ -1627,7 +1681,7 @@ int main() {
 struct timeval tv; gettimeofday(&tv);
 ; return 0; }
 EOF
-if { (eval echo configure:1643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1696: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_gettimeofday_args=1
 else
@@ -1667,12 +1721,12 @@ fi
 for ac_func in select fcntl uname nice setpriority getcwd getwd putenv
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1683: checking for $ac_func" >&5
+echo "configure:1736: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1688 "configure"
+#line 1741 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1695,7 +1749,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1722,12 +1776,12 @@ done
 for ac_func in sigaction
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1738: checking for $ac_func" >&5
+echo "configure:1791: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1743 "configure"
+#line 1796 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -1750,7 +1804,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -1779,17 +1833,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1795: checking for $ac_hdr" >&5
+echo "configure:1848: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1800 "configure"
+#line 1853 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1848,7 +1902,7 @@ fi
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1864: checking for X" >&5
+echo "configure:1917: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1910,12 +1964,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1926 "configure"
+#line 1979 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1984,14 +2038,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2000 "configure"
+#line 2053 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -2097,17 +2151,17 @@ else
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:2113: checking whether -R must be followed by a space" >&5
+echo "configure:2166: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 2116 "configure"
+#line 2169 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -2123,14 +2177,14 @@ rm -f conftest*
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 2139 "configure"
+#line 2192 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2199: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -2162,7 +2216,7 @@ rm -f conftest*
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:2178: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:2231: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2170,7 +2224,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2186 "configure"
+#line 2239 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2181,7 +2235,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2203,7 +2257,7 @@ fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:2219: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:2272: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2211,7 +2265,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2227 "configure"
+#line 2280 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2222,7 +2276,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2251,12 +2305,12 @@ fi
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2267: checking for gethostbyname" >&5
+echo "configure:2320: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2272 "configure"
+#line 2325 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2279,7 +2333,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2300,7 +2354,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2316: checking for gethostbyname in -lnsl" >&5
+echo "configure:2369: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2308,7 +2362,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2324 "configure"
+#line 2377 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2319,7 +2373,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2349,12 +2403,12 @@ fi
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2365: checking for connect" >&5
+echo "configure:2418: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2370 "configure"
+#line 2423 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2377,7 +2431,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2398,7 +2452,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2414: checking for connect in -lsocket" >&5
+echo "configure:2467: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2406,7 +2460,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2422 "configure"
+#line 2475 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2417,7 +2471,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2441,12 +2495,12 @@ fi
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2457: checking for remove" >&5
+echo "configure:2510: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2462 "configure"
+#line 2515 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2469,7 +2523,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2538: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2490,7 +2544,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2506: checking for remove in -lposix" >&5
+echo "configure:2559: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2498,7 +2552,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2514 "configure"
+#line 2567 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2509,7 +2563,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2533,12 +2587,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2549: checking for shmat" >&5
+echo "configure:2602: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2554 "configure"
+#line 2607 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2561,7 +2615,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2582,7 +2636,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2598: checking for shmat in -lipc" >&5
+echo "configure:2651: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2590,7 +2644,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2606 "configure"
+#line 2659 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2601,7 +2655,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2634,7 +2688,7 @@ fi
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2650: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2703: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2642,7 +2696,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2658 "configure"
+#line 2711 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2653,7 +2707,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2690,14 +2744,14 @@ fi
 
 
     echo $ac_n "checking for X app-defaults directory""... $ac_c" 1>&6
-echo "configure:2706: checking for X app-defaults directory" >&5
+echo "configure:2759: checking for X app-defaults directory" >&5
 if eval "test \"`echo '$''{'ac_cv_x_app_defaults'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   rm -fr conftestdir
   if mkdir conftestdir; then
-    cd conftestdir
+    cd conftestdir >&-
     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
     cat > Imakefile <<'EOF'
 acfindx:
@@ -2707,11 +2761,12 @@ EOF
       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
     fi
-    cd ..
+    cd .. >&-
     rm -fr conftestdir
   fi
       if test x"$ac_x_app_defaults" = x; then
-          # Look for the directory under a standard set of common directories.
+        
+  # Look for the directory under a standard set of common directories.
   # Check X11 before X11Rn because it's often a symlink to the current release.
   for ac_dir in                                        \
     /usr/X11/lib/app-defaults                  \
@@ -2808,6 +2863,23 @@ APPDEFAULTS=$ac_x_app_defaults
 
 
 
+# Usage: HANDLE_X_PATH_ARG([variable_name],
+#                         [--command-line-option],
+#                         [descriptive string])
+#
+# All of the --with options take three forms:
+#
+#   --with-foo (or --with-foo=yes)
+#   --without-foo (or --with-foo=no)
+#   --with-foo=/DIR
+#
+# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
+# a directory (string beginning with a slash) it checks to see whether
+# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
+# as appropriate.
+#
+
+
 
 
 # check for the HP XHPDisableReset server extension headers.
@@ -2819,7 +2891,7 @@ APPDEFAULTS=$ac_x_app_defaults
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 2835 "configure"
+#line 2906 "configure"
 #include "confdefs.h"
 #include <X11/XHPlib.h>
 EOF
@@ -2840,7 +2912,7 @@ rm -f conftest*
 # Check for the availability of the XPointer typedef, and define it otherwise.
 #
 echo $ac_n "checking for XPointer""... $ac_c" 1>&6
-echo "configure:2856: checking for XPointer" >&5
+echo "configure:2927: checking for XPointer" >&5
 if eval "test \"`echo '$''{'ac_cv_xpointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2851,14 +2923,14 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 2867 "configure"
+#line 2938 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
 XPointer foo = (XPointer) 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2874: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_xpointer=yes
 else
@@ -2880,44 +2952,119 @@ EOF
 fi
 
 
+# Random special-cases for certain pathological OSes.  You know who you are.
+#
 case "$host" in
   *-hpux*)
-    # Thanks for not making xmkmf find this by default, you losers.
+
+    # The following arcana was gleaned from conversations with
+    # Eric Schwartz <erics@col.hp.com>:
+    #
+    # On HPUX 10.x, the parts of X that HP considers "standard" live in
+    # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
+    # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
+    # Also, there are symlinks from /usr/include/ and /usr/lib/ into
+    # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
+    # you don't need any -I or -L arguments.
+    #
+    # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
+    # are the same division as 10.x.  However, there are no symlinks to
+    # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
+    # arguments are always necessary.
+    #
+    # However, X11R6 was available on HPUX 9.x as a patch: if that
+    # patch was installed, then all of X11R6 went in to
+    # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
+    #
+    # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
+    # whether R5 was available as a patch; R6 undoubtedly was not.)
+    #
+    # So.  We try and use the highest numbered pair of
+    # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
+    # that are available.  We do not mix and match different versions
+    # of X.
+    #
+    # Questions I still don't know the answers to: (do you?)
+    #
+    #   * Does HPUX 10.x come with /usr/contrib/X11R6/ standard?  
+    #     Or does that need to be installed separately?
+    #
+    #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
+    #     /usr/contrib/X11R6/ could be installed as a patch, what was in
+    #     that contrib directory?  Did it contain so-called "standard"
+    #     X11R6, or did it include Xaw and Xmu as well?  If the former,
+    #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
+    #     be a situation where one had to reach into the R5 headers and
+    #     libs to find Xmu?  That is, must both R6 and R5 directories
+    #     be on the -I and -L lists in that case?
+    #
+    for version in X11R6 X11R5 X11R4 ; do
+      # if either pair of directories exists...
+      if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib ; then
+         # if contrib exists, use it...
+         if test -d /usr/contrib/$version/lib ; then
+           X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
+           X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
+         fi
+         # if the "standard" one exists, use it.
+         if test -d /usr/lib/$version ; then
+           X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
+           X_LIBS="$X_LIBS -L/usr/lib/$version"
+         fi
+         # since at least one of the pair exists, go no farther.
+         break
+      fi
+    done
+
+    # Now find Motif.  Thanks for not making xmkmf find this by
+    # default, you losers.
+    #
     if test -d /usr/lib/Motif1.2 ; then
-      X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
+      X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
+      X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
     elif test -d /usr/lib/Motif1.1 ; then
-      X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
+      X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
+      X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
     fi
 
-    # This too.  You losers.
-    if test -d /usr/contrib/X11R6/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
-    elif test -d /usr/X11R6/include ; then
-      X_CFLAGS="-I/usr/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R6/lib $X_LIBS"
-    elif test -d /usr/contrib/X11R5/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
-    elif test -d /usr/X11R5/include ; then
-      X_CFLAGS="-I/usr/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R5/lib $X_LIBS"
+    # Now let's check for the pseudo-standard locations for OpenGL and XPM.
+    #
+    if test -d /opt/Mesa/lib ; then
+      X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
+      X_LIBS="-L/opt/Mesa/lib $X_LIBS"
+    fi
+
+    if test -d /opt/xpm/lib/X11 ; then
+      X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
+      X_LIBS="-L/opt/xpm/lib/X11 $X_LIBS"
+    fi
+
+    # On HPUX, default to installing in /opt/xscreensaver/ instead of
+    # in /usr/local/, unless there is already an xscreensaver in
+    # /usr/local/bin/.  This can be overridden with the --prefix arg
+    # to configure.  I'm not sure this is the right thing to do, but
+    # Richard Lloyd says so...
+    #
+    if test \! -x /usr/local/bin/xscreensaver ; then
+      ac_default_prefix=/opt/xscreensaver
     fi
 
   ;;
   *-solaris*)
-    # Same to you, pinheads.  (Is this really the standard location now?
-    # What happened to the joke that this kind of thing went in /opt?)
+
+    # Thanks for not making xmkmf find this by default, pinheads.
+    # And thanks for moving things around again, too.  Is this
+    # really the standard location now?  What happened to the
+    # joke that this kind of thing went in /opt?
     # cthomp says "answer: CDE (Common Disorganized Environment)"
+    #
     if test -f /usr/dt/include/Xm/Xm.h ; then
       X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
       X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
 
       # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
       echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6
-echo "configure:2933: checking for regcmp in -lgen" >&5
+echo "configure:3079: checking for regcmp in -lgen" >&5
 ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2925,7 +3072,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2941 "configure"
+#line 3087 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2936,7 +3083,7 @@ int main() {
 regcmp()
 ; return 0; }
 EOF
-if { (eval echo configure:2952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2973,17 +3120,17 @@ have_xmu=no
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/Xmu/Error.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Xmu/Error.h""... $ac_c" 1>&6
-echo "configure:2989: checking for X11/Xmu/Error.h" >&5
+echo "configure:3135: checking for X11/Xmu/Error.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2994 "configure"
+#line 3140 "configure"
 #include "confdefs.h"
 #include <X11/Xmu/Error.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3027,7 +3174,7 @@ if test $have_xmu = yes ; then
   case "$host" in
     *-sunos4*)
     echo $ac_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug""... $ac_c" 1>&6
-echo "configure:3043: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
+echo "configure:3189: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
 if eval "test \"`echo '$''{'ac_cv_sunos_xmu_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3040,14 +3187,14 @@ else
                    # with X libraries because we know it's SunOS.
                    LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
                    cat > conftest.$ac_ext <<EOF
-#line 3056 "configure"
+#line 3202 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_sunos_xmu_bug=no
 else
@@ -3063,21 +3210,21 @@ fi
 echo "$ac_t""$ac_cv_sunos_xmu_bug" 1>&6
     if test $ac_cv_sunos_xmu_bug = yes ; then
       echo $ac_n "checking whether the compiler understands -static""... $ac_c" 1>&6
-echo "configure:3079: checking whether the compiler understands -static" >&5
+echo "configure:3225: checking whether the compiler understands -static" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_static'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LDFLAGS="$LDFLAGS"
                      LDFLAGS="$LDFLAGS -static"
                      cat > conftest.$ac_ext <<EOF
-#line 3086 "configure"
+#line 3232 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3239: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_ld_static=yes
 else
@@ -3114,6 +3261,53 @@ else
   with_sgi=yes
 fi
 
+
+
+   case "$with_sgi" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for SGI SCREEN_SAVER headers""... $ac_c" 1>&6
+echo "configure:3284: checking for SGI SCREEN_SAVER headers" >&5
+     d=$with_sgi/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for SGI SCREEN_SAVER libs""... $ac_c" 1>&6
+echo "configure:3294: checking for SGI SCREEN_SAVER libs" >&5
+     d=$with_sgi/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgi_req="yes"
+     with_sgi=$with_sgi_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgi-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_sgi = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -3123,17 +3317,17 @@ if test $with_sgi = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/XScreenSaver.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/XScreenSaver.h""... $ac_c" 1>&6
-echo "configure:3139: checking for X11/extensions/XScreenSaver.h" >&5
+echo "configure:3332: checking for X11/extensions/XScreenSaver.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3144 "configure"
+#line 3337 "configure"
 #include "confdefs.h"
 #include <X11/extensions/XScreenSaver.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3178,6 +3372,53 @@ else
   with_mit=yes
 fi
 
+
+
+   case "$with_mit" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for MIT-SCREEN-SAVER headers""... $ac_c" 1>&6
+echo "configure:3395: checking for MIT-SCREEN-SAVER headers" >&5
+     d=$with_mit/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for MIT-SCREEN-SAVER libs""... $ac_c" 1>&6
+echo "configure:3405: checking for MIT-SCREEN-SAVER libs" >&5
+     d=$with_mit/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_mit_req="yes"
+     with_mit=$with_mit_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-mit-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $have_sgi != yes; then
   if test $with_mit = yes; then
     
@@ -3188,17 +3429,17 @@ if test $have_sgi != yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/scrnsaver.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/scrnsaver.h""... $ac_c" 1>&6
-echo "configure:3204: checking for X11/extensions/scrnsaver.h" >&5
+echo "configure:3444: checking for X11/extensions/scrnsaver.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3209 "configure"
+#line 3449 "configure"
 #include "confdefs.h"
 #include <X11/extensions/scrnsaver.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3454: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3242,7 +3483,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XScreenSaverRegister in -lXext""... $ac_c" 1>&6
-echo "configure:3258: checking for XScreenSaverRegister in -lXext" >&5
+echo "configure:3498: checking for XScreenSaverRegister in -lXext" >&5
 ac_lib_var=`echo Xext'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3250,7 +3491,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3266 "configure"
+#line 3506 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3261,7 +3502,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3517: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3312,7 +3553,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XScreenSaverRegister in -lXExExt""... $ac_c" 1>&6
-echo "configure:3328: checking for XScreenSaverRegister in -lXExExt" >&5
+echo "configure:3568: checking for XScreenSaverRegister in -lXExExt" >&5
 ac_lib_var=`echo XExExt'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3320,7 +3561,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXExExt -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3336 "configure"
+#line 3576 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3331,7 +3572,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3377,7 +3618,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XScreenSaverRegister in -lXss""... $ac_c" 1>&6
-echo "configure:3393: checking for XScreenSaverRegister in -lXss" >&5
+echo "configure:3633: checking for XScreenSaverRegister in -lXss" >&5
 ac_lib_var=`echo Xss'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3385,7 +3626,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXss -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3401 "configure"
+#line 3641 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3396,7 +3637,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3448,6 +3689,53 @@ else
   with_xidle=yes
 fi
 
+
+
+   case "$with_xidle" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XIDLE headers""... $ac_c" 1>&6
+echo "configure:3712: checking for XIDLE headers" >&5
+     d=$with_xidle/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XIDLE libs""... $ac_c" 1>&6
+echo "configure:3722: checking for XIDLE libs" >&5
+     d=$with_xidle/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xidle_req="yes"
+     with_xidle=$with_xidle_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xidle-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_xidle = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -3457,17 +3745,17 @@ if test $with_xidle = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/xidle.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/xidle.h""... $ac_c" 1>&6
-echo "configure:3473: checking for X11/extensions/xidle.h" >&5
+echo "configure:3760: checking for X11/extensions/xidle.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3478 "configure"
+#line 3765 "configure"
 #include "confdefs.h"
 #include <X11/extensions/xidle.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3770: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3511,6 +3799,53 @@ else
   with_xshm=yes
 fi
 
+
+
+   case "$with_xshm" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XSHM headers""... $ac_c" 1>&6
+echo "configure:3822: checking for XSHM headers" >&5
+     d=$with_xshm/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XSHM libs""... $ac_c" 1>&6
+echo "configure:3832: checking for XSHM libs" >&5
+     d=$with_xshm/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xshm_req="yes"
+     with_xshm=$with_xshm_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xshm-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_xshm = yes; then
 
   # first check for Xshm.h.
@@ -3522,17 +3857,17 @@ if test $with_xshm = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6
-echo "configure:3538: checking for X11/extensions/XShm.h" >&5
+echo "configure:3872: checking for X11/extensions/XShm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3543 "configure"
+#line 3877 "configure"
 #include "confdefs.h"
 #include <X11/extensions/XShm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3882: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3566,17 +3901,17 @@ fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6
-echo "configure:3582: checking for sys/ipc.h" >&5
+echo "configure:3916: checking for sys/ipc.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3587 "configure"
+#line 3921 "configure"
 #include "confdefs.h"
 #include <sys/ipc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3592: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3926: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3611,17 +3946,17 @@ fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6
-echo "configure:3627: checking for sys/shm.h" >&5
+echo "configure:3961: checking for sys/shm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3632 "configure"
+#line 3966 "configure"
 #include "confdefs.h"
 #include <sys/shm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3670,7 +4005,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6
-echo "configure:3686: checking for XShmQueryExtension in -lXextSam" >&5
+echo "configure:4020: checking for XShmQueryExtension in -lXextSam" >&5
 ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3678,7 +4013,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXextSam -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3694 "configure"
+#line 4028 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3689,7 +4024,7 @@ int main() {
 XShmQueryExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:3705: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3740,6 +4075,53 @@ else
   with_sgivc=yes
 fi
 
+
+
+   case "$with_sgivc" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for SGI-VIDEO-CONTROL headers""... $ac_c" 1>&6
+echo "configure:4098: checking for SGI-VIDEO-CONTROL headers" >&5
+     d=$with_sgivc/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for SGI-VIDEO-CONTROL libs""... $ac_c" 1>&6
+echo "configure:4108: checking for SGI-VIDEO-CONTROL libs" >&5
+     d=$with_sgivc/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgivc_req="yes"
+     with_sgivc=$with_sgivc_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgivc-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_sgivc = yes; then
 
   # first check for XSGIvc.h
@@ -3751,17 +4133,17 @@ if test $with_sgivc = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6
-echo "configure:3767: checking for X11/extensions/XSGIvc.h" >&5
+echo "configure:4148: checking for X11/extensions/XSGIvc.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3772 "configure"
+#line 4153 "configure"
 #include "confdefs.h"
 #include <X11/extensions/XSGIvc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3777: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3804,7 +4186,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6
-echo "configure:3820: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
+echo "configure:4201: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
 ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3812,7 +4194,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXsgivc -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3828 "configure"
+#line 4209 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3823,7 +4205,7 @@ int main() {
 XSGIvcQueryGammaMap()
 ; return 0; }
 EOF
-if { (eval echo configure:3839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4220: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3873,6 +4255,53 @@ else
   with_dpms=yes
 fi
 
+
+
+   case "$with_dpms" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for DPMS headers""... $ac_c" 1>&6
+echo "configure:4278: checking for DPMS headers" >&5
+     d=$with_dpms/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for DPMS libs""... $ac_c" 1>&6
+echo "configure:4288: checking for DPMS libs" >&5
+     d=$with_dpms/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_dpms_req="yes"
+     with_dpms=$with_dpms_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_dpms = yes; then
 
   # first check for dpms.h
@@ -3884,17 +4313,17 @@ if test $with_dpms = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6
-echo "configure:3900: checking for X11/extensions/dpms.h" >&5
+echo "configure:4328: checking for X11/extensions/dpms.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3905 "configure"
+#line 4333 "configure"
 #include "confdefs.h"
 #include <X11/extensions/dpms.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3910: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4338: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3937,7 +4366,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6
-echo "configure:3953: checking for DPMSInfo in -lXdpms" >&5
+echo "configure:4381: checking for DPMSInfo in -lXdpms" >&5
 ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3945,7 +4374,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXdpms -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3961 "configure"
+#line 4389 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3956,7 +4385,7 @@ int main() {
 DPMSInfo()
 ; return 0; }
 EOF
-if { (eval echo configure:3972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4012,6 +4441,52 @@ else
 fi
 
 
+
+   case "$with_motif" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Motif headers""... $ac_c" 1>&6
+echo "configure:4463: checking for Motif headers" >&5
+     d=$with_motif/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Motif libs""... $ac_c" 1>&6
+echo "configure:4473: checking for Motif libs" >&5
+     d=$with_motif/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_motif_req="yes"
+     with_motif=$with_motif_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-motif must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 # Check whether --with-athena or --without-athena was given.
 if test "${with_athena+set}" = set; then
   withval="$with_athena"
@@ -4021,6 +4496,52 @@ else
 fi
 
 
+
+   case "$with_athena" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Athena headers""... $ac_c" 1>&6
+echo "configure:4518: checking for Athena headers" >&5
+     d=$with_athena/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Athena libs""... $ac_c" 1>&6
+echo "configure:4528: checking for Athena libs" >&5
+     d=$with_athena/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_athena_req="yes"
+     with_athena=$with_athena_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-athena must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_motif != yes -a $with_motif != no ; then
   echo "error: must be yes or no: --with-motif=$with_motif"
   exit 1
@@ -4055,17 +4576,17 @@ check_motif() {
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
-echo "configure:4071: checking for Xm/Xm.h" >&5
+echo "configure:4591: checking for Xm/Xm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4076 "configure"
+#line 4596 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4601: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4105,17 +4626,17 @@ check_athena() {
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/Xaw/Dialog.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Xaw/Dialog.h""... $ac_c" 1>&6
-echo "configure:4121: checking for X11/Xaw/Dialog.h" >&5
+echo "configure:4641: checking for X11/Xaw/Dialog.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4126 "configure"
+#line 4646 "configure"
 #include "confdefs.h"
 #include <X11/Xaw/Dialog.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4651: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4154,7 +4675,7 @@ fi
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6
-echo "configure:4170: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5
+echo "configure:4690: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5
 ac_lib_var=`echo Xaw3d'_'Xaw3dComputeTopShadowRGB | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4162,7 +4683,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXaw3d -lXt -lXmu -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4178 "configure"
+#line 4698 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4173,7 +4694,7 @@ int main() {
 Xaw3dComputeTopShadowRGB()
 ; return 0; }
 EOF
-if { (eval echo configure:4189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4249,7 +4770,7 @@ fi
 # XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
 if test $have_athena = yes ; then
   echo $ac_n "checking for XawViewportSetCoordinates in Viewport.h""... $ac_c" 1>&6
-echo "configure:4265: checking for XawViewportSetCoordinates in Viewport.h" >&5
+echo "configure:4785: checking for XawViewportSetCoordinates in Viewport.h" >&5
 if eval "test \"`echo '$''{'ac_cv_have_XawViewportSetCoordinates'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4261,7 +4782,7 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4277 "configure"
+#line 4797 "configure"
 #include "confdefs.h"
 #include <X11/Xaw/Viewport.h>
 EOF
@@ -4290,7 +4811,7 @@ fi
 have_lesstif=no
 if test $have_motif = yes ; then
   echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6
-echo "configure:4306: checking whether Motif is really LessTif" >&5
+echo "configure:4826: checking whether Motif is really LessTif" >&5
 if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4301,14 +4822,14 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4317 "configure"
+#line 4837 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 int main() {
 long vers = LesstifVersion;
 ; return 0; }
 EOF
-if { (eval echo configure:4324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4844: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_have_lesstif=yes
 else
@@ -4325,16 +4846,19 @@ echo "$ac_t""$ac_cv_have_lesstif" 1>&6
   have_lesstif=$ac_cv_have_lesstif
 fi
 
-# don't cache this
-unset ac_cv_good_lesstif
+# don't cache these
+unset ac_cv_lesstif_version
+unset ac_cv_lesstif_version_string
+
+lesstif_version=unknown
+lesstif_version_string=unknown
 
-good_lesstif=no
 if test $have_lesstif = yes ; then
-  # It must be at least "GNU Lesstif 0.82".
-  # #### If you change this, also sync the warning message lower down.
-  echo $ac_n "checking whether LessTif is of a recent enough vintage""... $ac_c" 1>&6
-echo "configure:4349: checking whether LessTif is of a recent enough vintage" >&5
-if eval "test \"`echo '$''{'ac_cv_good_lesstif'+set}'`\" = set"; then
+  ltv=unknown
+  echo unknown > conftest-lt
+  echo $ac_n "checking LessTif version number""... $ac_c" 1>&6
+echo "configure:4872: checking LessTif version number" >&5
+if eval "test \"`echo '$''{'ac_cv_lesstif_version_string'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
@@ -4344,23 +4868,34 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   if test "$cross_compiling" = yes; then
-  # cross compiling?  Make an ass out of umption.
-                              ac_cv_good_lesstif=yes
+  ac_cv_lesstif_version=unknown
+                    ac_cv_lesstif_version_string=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 4364 "configure"
+#line 4887 "configure"
 #include "confdefs.h"
-#include <Xm/Xm.h>
-                               int main() { exit(LesstifVersion < 82); }
-EOF
-if { (eval echo configure:4369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+#include <stdio.h>
+                    #include <Xm/Xm.h>
+                    int main() {
+                      FILE *f = fopen("conftest-lt", "w");
+                      if (!f) exit(1);
+                      fprintf(f, "%d %d.%d\n", LesstifVersion,
+                         LESSTIF_VERSION, LESSTIF_REVISION);
+                      fclose(f);
+                      exit(0);
+                    }
+EOF
+if { (eval echo configure:4900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
-  ac_cv_good_lesstif=yes
+  ltv=`cat conftest-lt`
+                    ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
+                    ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -fr conftest*
-  ac_cv_good_lesstif=no
+  ac_cv_lesstif_version=unknown
+                    ac_cv_lesstif_version_string=unknown
 fi
 rm -fr conftest*
 fi
@@ -4368,8 +4903,11 @@ fi
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-echo "$ac_t""$ac_cv_good_lesstif" 1>&6
-  good_lesstif=$ac_cv_good_lesstif
+echo "$ac_t""$ac_cv_lesstif_version_string" 1>&6
+  rm -f conftest-lt
+  lesstif_version=$ac_cv_lesstif_version
+  lesstif_version_string=$ac_cv_lesstif_version_string
+
 fi
 
 
@@ -4397,7 +4935,7 @@ if test $have_motif = yes ; then
     LDFLAGS="$LDFLAGS -L$x_libraries"
   fi
   echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6
-echo "configure:4413: checking for XpQueryExtension in -lXp" >&5
+echo "configure:4950: checking for XpQueryExtension in -lXp" >&5
 ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4405,7 +4943,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXp -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4421 "configure"
+#line 4958 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4416,7 +4954,7 @@ int main() {
 XpQueryExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:4432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4453,6 +4991,53 @@ else
   with_xpm=yes
 fi
 
+
+
+   case "$with_xpm" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XPM headers""... $ac_c" 1>&6
+echo "configure:5014: checking for XPM headers" >&5
+     d=$with_xpm/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XPM libs""... $ac_c" 1>&6
+echo "configure:5024: checking for XPM libs" >&5
+     d=$with_xpm/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xpm_req="yes"
+     with_xpm=$with_xpm_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xpm must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_xpm = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -4462,17 +5047,17 @@ if test $with_xpm = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6
-echo "configure:4478: checking for X11/xpm.h" >&5
+echo "configure:5062: checking for X11/xpm.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4483 "configure"
+#line 5067 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5072: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4518,6 +5103,55 @@ else
 fi
 
 
+
+   case "$with_gl" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for GL headers""... $ac_c" 1>&6
+echo "configure:5125: checking for GL headers" >&5
+     d=$with_gl/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for GL libs""... $ac_c" 1>&6
+echo "configure:5135: checking for GL libs" >&5
+     d=$with_gl/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_gl_req="yes"
+     with_gl=$with_gl_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-gl must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
+ac_mesagl_version=unknown
+ac_mesagl_version_string=unknown
+
 if test $with_gl = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -4527,17 +5161,17 @@ if test $with_gl = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6
-echo "configure:4543: checking for GL/gl.h" >&5
+echo "configure:5176: checking for GL/gl.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4548 "configure"
+#line 5181 "configure"
 #include "confdefs.h"
 #include <GL/gl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5186: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4568,17 +5202,17 @@ fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6
-echo "configure:4584: checking for GL/glx.h" >&5
+echo "configure:5217: checking for GL/glx.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4589 "configure"
+#line 5222 "configure"
 #include "confdefs.h"
 #include <GL/glx.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4594: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
 #define HAVE_GL 1
 EOF
 
-    have_mesa_gl=no
-    
+
+    # We need to know whether it's MesaGL so that we know which libraries
+    # to link against.
+    #
+    echo $ac_n "checking whether GL is really MesaGL""... $ac_c" 1>&6
+echo "configure:5264: checking whether GL is really MesaGL" >&5
+    if eval "test \"`echo '$''{'ac_cv_have_mesa_gl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_have_mesa_gl=no
+       
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4634 "configure"
+#line 5276 "configure"
 #include "confdefs.h"
 #include <GL/glx.h>
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "Mesa" >/dev/null 2>&1; then
   rm -rf conftest*
-  have_mesa_gl=yes
+  ac_cv_have_mesa_gl=yes
 fi
 rm -f conftest*
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-    if test $have_mesa_gl = no ; then
+      
+fi
+
+    ac_have_mesa_gl=$ac_cv_have_mesa_gl
+    echo "$ac_t""$ac_have_mesa_gl" 1>&6
+
+    if test $ac_have_mesa_gl = no ; then
+      gl_lib_1="GL"
       GL_LIBS="-lGL -lGLU"
     else
       cat >> confdefs.h <<\EOF
 #define HAVE_MESA_GL 1
 EOF
 
+      gl_lib_1="MesaGL"
       GL_LIBS="-lMesaGL -lMesaGLU"
     fi
+
+
+    # If it's MesaGL, we'd like to issue a warning if the version number
+    # is less than or equal to 2.6, because that version had a security bug.
+    #
+    if test $ac_have_mesa_gl = yes; then
+
+      # don't cache these.
+      unset ac_cv_mesagl_version
+      unset ac_cv_mesagl_version_string
+
+      echo $ac_n "checking MesaGL version number""... $ac_c" 1>&6
+echo "configure:5317: checking MesaGL version number" >&5
+      if eval "test \"`echo '$''{'ac_cv_mesagl_version_string'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 5322 "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+#configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
+EOF
+
+        mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | sed -n \
+             's/^#configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
+        if test "$mglv" = ""; then
+           ac_mesagl_version=unknown
+           ac_mesagl_version_string=unknown
+         else
+           ac_mesagl_version_string=$mglv
+           maj=`echo $mglv | sed -n 's/\..*//p'`
+           min=`echo $mglv | sed -n 's/.*\.//p'`
+           ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
+         fi
+         ac_cv_mesagl_version=$ac_mesagl_version
+         ac_cv_mesagl_version_string=$ac_mesagl_version_string
+      
+fi
+
+      ac_mesagl_version=$ac_cv_mesagl_version
+      ac_mesagl_version_string=$ac_cv_mesagl_version_string
+      echo "$ac_t""$ac_cv_mesagl_version_string" 1>&6
+    fi
+
+
+    # Check for OpenGL 1.1 features.
+    #
+    
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  if test \! -z "$x_libraries" ; then
+    LDFLAGS="$LDFLAGS -L$x_libraries"
+  fi
+  echo $ac_n "checking for glBindTexture in -l$gl_lib_1""... $ac_c" 1>&6
+echo "configure:5369: checking for glBindTexture in -l$gl_lib_1" >&5
+ac_lib_var=`echo $gl_lib_1'_'glBindTexture | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5377 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char glBindTexture();
+
+int main() {
+glBindTexture()
+; return 0; }
+EOF
+if { (eval echo configure:5388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GLBINDTEXTURE 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+
   fi
 
 elif test $with_gl != no; then
@@ -4659,6 +5419,53 @@ else
   with_readdisplay=yes
 fi
 
+
+
+   case "$with_readdisplay" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XReadDisplay headers""... $ac_c" 1>&6
+echo "configure:5442: checking for XReadDisplay headers" >&5
+     d=$with_readdisplay/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XReadDisplay libs""... $ac_c" 1>&6
+echo "configure:5452: checking for XReadDisplay libs" >&5
+     d=$with_readdisplay/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_readdisplay_req="yes"
+     with_readdisplay=$with_readdisplay_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-readdisplay must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_readdisplay = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -4668,17 +5475,17 @@ if test $with_readdisplay = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6
-echo "configure:4684: checking for X11/extensions/readdisplay.h" >&5
+echo "configure:5490: checking for X11/extensions/readdisplay.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4689 "configure"
+#line 5495 "configure"
 #include "confdefs.h"
 #include <X11/extensions/readdisplay.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4694: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4721,6 +5528,53 @@ else
   with_sgivideo=yes
 fi
 
+
+
+   case "$with_sgivideo" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Iris Video headers""... $ac_c" 1>&6
+echo "configure:5551: checking for Iris Video headers" >&5
+     d=$with_sgivideo/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Iris Video libs""... $ac_c" 1>&6
+echo "configure:5561: checking for Iris Video libs" >&5
+     d=$with_sgivideo/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgivideo_req="yes"
+     with_sgivideo=$with_sgivideo_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgivideo must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
 if test $with_sgivideo = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -4730,17 +5584,17 @@ if test $with_sgivideo = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "dmedia/vl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dmedia/vl.h""... $ac_c" 1>&6
-echo "configure:4746: checking for dmedia/vl.h" >&5
+echo "configure:5599: checking for dmedia/vl.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4751 "configure"
+#line 5604 "configure"
 #include "confdefs.h"
 #include <dmedia/vl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4756: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4765,7 +5619,7 @@ fi
   if test $have_sgivideo = yes; then
     have_sgivideo=no
     echo $ac_n "checking for vlOpenVideo in -lvl""... $ac_c" 1>&6
-echo "configure:4781: checking for vlOpenVideo in -lvl" >&5
+echo "configure:5634: checking for vlOpenVideo in -lvl" >&5
 ac_lib_var=`echo vl'_'vlOpenVideo | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4773,7 +5627,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lvl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 5642 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4784,7 +5638,7 @@ int main() {
 vlOpenVideo()
 ; return 0; }
 EOF
-if { (eval echo configure:4800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4852,7 +5706,7 @@ if test -n "$with_zippy_req" ; then
   case "$with_zippy_req" in
     /*)
       echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6
-echo "configure:4868: checking for $with_zippy_req" >&5
+echo "configure:5721: checking for $with_zippy_req" >&5
       if test -x "$with_zippy_req" ; then
         echo "$ac_t""yes" 1>&6
       else
@@ -4866,7 +5720,7 @@ echo "configure:4868: checking for $with_zippy_req" >&5
       # Extract the first word of "$with_zippy_req", so it can be a program name with args.
 set dummy $with_zippy_req; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4882: checking for $ac_word" >&5
+echo "configure:5735: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4912,7 +5766,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4928: checking for $ac_word" >&5
+echo "configure:5781: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4945,7 +5799,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4961: checking for $ac_word" >&5
+echo "configure:5814: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4979,7 +5833,7 @@ done
 
   if test -n "$emacs_exe" ; then
     echo $ac_n "checking for emacs yow""... $ac_c" 1>&6
-echo "configure:4995: checking for emacs yow" >&5
+echo "configure:5848: checking for emacs yow" >&5
     #
     # get emacs to tell us where the libexec directory is.
     #
@@ -5001,7 +5855,7 @@ echo "configure:4995: checking for emacs yow" >&5
 
   if test -z "$ac_cv_zippy_program" ; then
     echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6
-echo "configure:5017: checking for xemacs yow" >&5
+echo "configure:5870: checking for xemacs yow" >&5
     if test -n "$xemacs_exe" ; then
       #
       # get xemacs to tell us where the libexec directory is.
@@ -5047,7 +5901,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5063: checking for $ac_word" >&5
+echo "configure:5916: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5082,7 +5936,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5098: checking for $ac_word" >&5
+echo "configure:5951: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5159,9 +6013,56 @@ else
   with_kerberos=yes
 fi
 
+
+  
+   case "$with_kerberos" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Kerberos headers""... $ac_c" 1>&6
+echo "configure:6036: checking for Kerberos headers" >&5
+     d=$with_kerberos/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Kerberos libs""... $ac_c" 1>&6
+echo "configure:6046: checking for Kerberos libs" >&5
+     d=$with_kerberos/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_kerberos_req="yes"
+     with_kerberos=$with_kerberos_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-kerberos must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
   if test $with_kerberos = yes; then
     echo $ac_n "checking for Kerberos""... $ac_c" 1>&6
-echo "configure:5177: checking for Kerberos" >&5
+echo "configure:6077: checking for Kerberos" >&5
 if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5172,14 +6073,14 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5188 "configure"
+#line 6088 "configure"
 #include "confdefs.h"
 #include <krb.h>
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_kerberos=yes
 else
@@ -5199,7 +6100,100 @@ echo "$ac_t""$ac_cv_kerberos" 1>&6
 #define HAVE_KERBEROS 1
 EOF
 
-      PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
+
+      # from Tim Showalter <tjs+@andrew.cmu.edu>
+      PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
+      echo $ac_n "checking for res_search""... $ac_c" 1>&6
+echo "configure:6119: checking for res_search" >&5
+if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6124 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char res_search(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char res_search();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_res_search) || defined (__stub___res_search)
+choke me
+#else
+res_search();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:6147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_res_search=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_res_search=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
+echo "configure:6165: checking for res_search in -lresolv" >&5
+ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lresolv  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6173 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char res_search();
+
+int main() {
+res_search()
+; return 0; }
+EOF
+if { (eval echo configure:6184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  PASSWD_LIBS="${PASSWD_LIBS} -lresolv"
+else
+  echo "$ac_t""no" 1>&6
+echo "configure: warning: Can't find DNS resolver libraries needed for Kerberos" 1>&2
+       
+fi
+
+fi
+
+
     fi
   elif test $with_kerberos != no; then
     echo "error: must be yes or no: --with-kerberos=$with_kerberos"
@@ -5217,6 +6211,53 @@ else
   with_shadow=yes
 fi
 
+
+  
+   case "$with_shadow" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for shadow password headers""... $ac_c" 1>&6
+echo "configure:6234: checking for shadow password headers" >&5
+     d=$with_shadow/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for shadow password libs""... $ac_c" 1>&6
+echo "configure:6244: checking for shadow password libs" >&5
+     d=$with_shadow/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_shadow_req="yes"
+     with_shadow=$with_shadow_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-shadow must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  
+
   if test $with_shadow = no; then
     passwd_cruft_done=yes
   elif test $with_shadow != yes; then
@@ -5229,7 +6270,7 @@ fi
   #
   if test $passwd_cruft_done = no ; then
     echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5245: checking for Sun-style shadow passwords" >&5
+echo "configure:6285: checking for Sun-style shadow passwords" >&5
 if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5240,7 +6281,7 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5256 "configure"
+#line 6296 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                                      #include <unistd.h>
@@ -5253,7 +6294,7 @@ struct passwd_adjunct *p = getpwanam("nobody");
                         const char *pw = p->pwa_passwd;
 ; return 0; }
 EOF
-if { (eval echo configure:5269: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sun_adjunct=yes
 else
@@ -5282,7 +6323,7 @@ EOF
   #
   if test $passwd_cruft_done = no ; then
     echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5298: checking for DEC-style shadow passwords" >&5
+echo "configure:6338: checking for DEC-style shadow passwords" >&5
 if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5293,7 +6334,7 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5309 "configure"
+#line 6349 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                                      #include <unistd.h>
@@ -5310,7 +6351,7 @@ struct pr_passwd *p;
                         pw = p->ufld.fd_encrypt;
 ; return 0; }
 EOF
-if { (eval echo configure:5326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_enhanced_passwd=yes
 else
@@ -5336,7 +6377,7 @@ EOF
       # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
       # (I'm told it needs -lcurses too, but I don't understand why.)
       echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6
-echo "configure:5352: checking for getprpwnam in -lprot" >&5
+echo "configure:6392: checking for getprpwnam in -lprot" >&5
 ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5344,7 +6385,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lprot -lx $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5360 "configure"
+#line 6400 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5355,7 +6396,7 @@ int main() {
 getprpwnam()
 ; return 0; }
 EOF
-if { (eval echo configure:5371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5375,7 +6416,7 @@ else
   echo "$ac_t""no" 1>&6
 # On DEC, getprpwnam() is in -lsecurity
                    echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6
-echo "configure:5391: checking for getprpwnam in -lsecurity" >&5
+echo "configure:6431: checking for getprpwnam in -lsecurity" >&5
 ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5383,7 +6424,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsecurity  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5399 "configure"
+#line 6439 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5394,7 +6435,7 @@ int main() {
 getprpwnam()
 ; return 0; }
 EOF
-if { (eval echo configure:5410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5423,7 +6464,7 @@ fi
   #
   if test $passwd_cruft_done = no ; then
     echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5439: checking for HP-style shadow passwords" >&5
+echo "configure:6479: checking for HP-style shadow passwords" >&5
 if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5434,7 +6475,7 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5450 "configure"
+#line 6490 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                                      #include <unistd.h>
@@ -5447,7 +6488,7 @@ struct s_passwd *p = getspwnam("nobody");
                         const char *pw = p->pw_passwd;
 ; return 0; }
 EOF
-if { (eval echo configure:5463: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6503: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_hpux_passwd=yes
 else
@@ -5472,7 +6513,7 @@ EOF
 
       # on HPUX, bigcrypt is in -lsec
       echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6
-echo "configure:5488: checking for bigcrypt in -lsec" >&5
+echo "configure:6528: checking for bigcrypt in -lsec" >&5
 ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5480,7 +6521,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsec  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5496 "configure"
+#line 6536 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5491,7 +6532,7 @@ int main() {
 bigcrypt()
 ; return 0; }
 EOF
-if { (eval echo configure:5507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5518,7 +6559,7 @@ fi
   #
   if test $passwd_cruft_done = no ; then
     echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6
-echo "configure:5534: checking for generic shadow passwords" >&5
+echo "configure:6574: checking for generic shadow passwords" >&5
 if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5529,7 +6570,7 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 5545 "configure"
+#line 6585 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
                                      #include <unistd.h>
@@ -5541,7 +6582,7 @@ struct spwd *p = getspnam("nobody");
                         const char *pw = p->sp_pwdp;
 ; return 0; }
 EOF
-if { (eval echo configure:5557: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_shadow=yes
 else
@@ -5567,7 +6608,7 @@ EOF
       # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
       have_getspnam=no
       echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6
-echo "configure:5583: checking for getspnam in -lc" >&5
+echo "configure:6623: checking for getspnam in -lc" >&5
 ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5575,7 +6616,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5591 "configure"
+#line 6631 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5586,7 +6627,7 @@ int main() {
 getspnam()
 ; return 0; }
 EOF
-if { (eval echo configure:5602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5608,7 +6649,7 @@ fi
 
       if test $have_getspnam = no ; then
         echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6
-echo "configure:5624: checking for getspnam in -lgen" >&5
+echo "configure:6664: checking for getspnam in -lgen" >&5
 ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5616,7 +6657,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5632 "configure"
+#line 6672 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5627,7 +6668,7 @@ int main() {
 getspnam()
 ; return 0; }
 EOF
-if { (eval echo configure:5643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5658,7 +6699,7 @@ fi
   #
   if test $passwd_cruft_done = no ; then
     echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5674: checking for FreeBSD-style shadow passwords" >&5
+echo "configure:6714: checking for FreeBSD-style shadow passwords" >&5
 if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5679,7 +6720,7 @@ echo "$ac_t""$ac_cv_master_passwd" 1>&6
   # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
   have_crypt=no
   echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6
-echo "configure:5695: checking for crypt in -lc" >&5
+echo "configure:6735: checking for crypt in -lc" >&5
 ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5687,7 +6728,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5703 "configure"
+#line 6743 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5698,7 +6739,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:5714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5720,7 +6761,7 @@ fi
 
   if test $have_crypt = no ; then
     echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:5736: checking for crypt in -lcrypt" >&5
+echo "configure:6776: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5728,7 +6769,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5744 "configure"
+#line 6784 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5739,7 +6780,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:5755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5801,9 +6842,6 @@ DEPEND_FLAGS=
 DEPEND_DEFINES=
 
 
-# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own...
-INSTALL_DIRS='$(INSTALL) -d'
-
 # Done testing things -- now substitute in some stuff for the Makefiles.
 #
 if test $have_motif = yes; then
@@ -5892,8 +6930,13 @@ fi
 
 # Print some warnings before emitting the Makefiles.
 #
+warn_prefix_1="    Warning:"
+warn_prefix_2="       Note:"
+warn_prefix="$warn_prefix_1"
+
 warning=no
 warnsep='    #################################################################'
+
 warnpre() {
   if test $warning = no ; then
     echo '' ; echo "$warnsep" ; echo ''
@@ -5905,7 +6948,7 @@ warn() {
   warnpre
   if test $warning = long ; then echo '' ; fi
   warning=yes
-  echo "    Warning: $@"
+  echo "$warn_prefix $@"
 }
 
 warnL() {
@@ -5913,7 +6956,7 @@ warnL() {
   warnpre
   warning=yes
   if test $was != no ; then echo '' ; fi
-  echo "    Warning: $@"
+  echo "$warn_prefix $@"
 }
 
 warn2() {
@@ -5921,6 +6964,19 @@ warn2() {
   warning=long
 }
 
+note() {
+  warn_prefix="$warn_prefix_2"
+  warn $@
+  warn_prefix="$warn_prefix_1"
+}
+
+noteL() {
+  warn_prefix="$warn_prefix_2"
+  warnL $@
+  warn_prefix="$warn_prefix_1"
+}
+
+
 if test $with_sgi_req = yes -a $have_sgi = no ; then
   warn 'The SGI saver extension was requested, but was not found.'
 fi
@@ -5960,12 +7016,28 @@ elif test $with_athena_req = yes -a $have_athena = no ; then
 fi
 
 if test $have_motif = yes -a $have_lesstif = yes ; then
-  if test $good_lesstif != yes ; then
-    warnL "Motif is being used, but it appears to actually be"
-    warn2 "LessTif, and the version number is less than 0.82!"
-    warn2 "Such old versions of LessTif are too buggy to use"
-    warn2 "with XScreenSaver; it is strongly recommended that"
-    warn2 "you upgrade!  See <http://www.lesstif.org/>."
+
+  preferred_lesstif=0.87
+
+  if test $lesstif_version = unknown; then
+    warnL "Unable to determine the LessTif version number!"
+    warn2 "Make sure you are using version $preferred_lesstif or newer."
+    warn2 "See <http://www.lesstif.org/>."
+
+  elif test \! $lesstif_version -gt 82; then
+    warnL "LessTif version $lesstif_version_string is being used."
+    warn2 "LessTif versions 0.82 and earlier are too buggy to"
+    warn2 "use with XScreenSaver; it is strongly recommended"
+    warn2 "that you upgrade to at least version $preferred_lesstif!"
+    warn2 "See <http://www.lesstif.org/>."
+
+  elif test \! $lesstif_version -gt 86; then
+    warnL "LessTif version $lesstif_version_string is being used."
+    warn2 "LessTif versions 0.86 and earlier have a bug that"
+    warn2 "can cause a security problem with xscreensaver."
+    warn2 "If you want to use xscreensaver as a screen locker,"
+    warn2 "it is strongly recommended that you upgrade to at"
+    warn2 "least version $preferred_lesstif.  See <http://www.lesstif.org/>."
   fi
 fi
 
@@ -5978,12 +7050,58 @@ if test $proselytize_motif = yes ; then
     warn2 "available as well: see <http://www.lesstif.org/>."
 fi
 
-if test $with_xpm_req = yes -a $have_xpm = no ; then
-  warn 'Use of XPM was requested, but it was not found.'
+
+if test $have_gl = yes -a $ac_have_mesa_gl = yes ; then
+  preferred_mesagl=2.7
+
+  if test $ac_mesagl_version = unknown; then
+    warnL "Unable to determine the MesaGL version number!"
+    warn2 "Make sure you are using version $preferred_mesagl or newer."
+
+  elif test \! $ac_mesagl_version -gt 2006; then
+    warnL "MesaGL version $ac_mesagl_version_string is being used."
+    warn2 "MesaGL versions 2.6 and earlier have a security bug."
+    warn2 "It is strongly recommended that you upgrade to at"
+    warn2 "least version $preferred_mesagl."
+  fi
 fi
 
-if test $with_gl_req = yes -a $have_gl = no ; then
-  warn 'Use of GL was requested, but it was not found.'
+
+if test $have_xpm = no ; then
+  if test $with_xpm_req = yes ; then
+    warnL 'Use of XPM was requested, but it was not found.'
+  elif test $with_xpm_req = no ; then
+    noteL 'The XPM library is not being used.'
+  else
+    noteL 'The XPM library was not found.'
+  fi
+
+  echo ''
+  warn2 'Some of the demos will not be as colorful as they'
+  warn2 'could be.  You might want to consider installing XPM'
+  warn2 'and re-running configure.  (Remember to delete the'
+  warn2 'config.cache file first.)  You can find XPM at most'
+  warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
+fi
+
+if test $have_gl = no ; then
+  if test $with_gl_req = yes ; then
+    warnL 'Use of GL was requested, but it was not found.'
+  elif test $with_gl_req = no ; then
+    noteL 'The OpenGL 3D library is not being used.'
+  else
+    noteL 'The OpenGL 3D library was not found.'
+  fi
+
+  echo ''
+  warn2 'Those demos which use 3D will not be built or installed.'
+  warn2 'You might want to consider installing OpenGL and'
+  warn2 're-running configure.  (Remember to delete the'
+  warn2 "config.cache file first.)  If your vendor doesn't ship"
+  warn2 'their own implementation of OpenGL, you can get a free'
+  warn2 'version at <http://www.ssec.wisc.edu/~brianp/Mesa.html>.'
+  warn2 'For general OpenGL info, see <http://www.opengl.org/>.'
+
 fi
 
 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
@@ -6443,7 +7561,7 @@ echo '      When you run "make install", the "xscreensaver" and'
 echo '      "xscreensaver-command" executables will be installed in'
 echo "      ${bindir}."
 echo ""
-echo "      The various graphics demos (60+ different executables) will"
+echo "      The various graphics demos (80+ different executables) will"
 echo "      be installed in ${HACKDIR}."
 echo ""
 echo "      If you would prefer the demos to be installed elsewhere"
index be98708834421d676a1d1a7ced0448feda9ce4b0..c805692d4e2c5e7c6ddc7f5737b90e9936dd5d32 100644 (file)
@@ -19,8 +19,10 @@ if test -z "$GCC"; then
       CC="$CC -qlanglvl=ansi -qhalt=e"
     ;;
 
-# NOTE:   for Digital, need to add -std1 to get ANSI, but I'm not sure
-#         yet what $host pattern we should be testing for...
+    *-dec-*)
+      AC_MSG_RESULT(DEC: adding -std1)
+      CC="$CC -std1"
+    ;;
 
     *)
       AC_MSG_RESULT(no idea)
@@ -38,20 +40,66 @@ AC_TRY_RUN([ main(int ac, char **av) { return 0; } ],
 
 case "$host" in
   *-irix*)
-  if test -n "$GCC"; then
-    AC_MSG_RESULT(Turning on gcc compiler warnings.)
-    CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
-  else
-    # not gcc
-    AC_MSG_RESULT(Turning on SGI compiler warnings.)
-    CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
-  fi
+    if test -n "$GCC"; then
+      AC_MSG_RESULT(Turning on gcc compiler warnings.)
+      CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
+    else
+      # not gcc
+      AC_MSG_RESULT(Turning on SGI compiler warnings.)
+      CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
+    fi
+  ;;
+
+    *-linux-*)
+      AC_MSG_RESULT(Turning on gcc compiler warnings.)
+      CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
   ;;
+
+#  *-dec-osf*)
+#    if test -z "$GCC"; then
+#      AC_MSG_RESULT(Turning on DEC C compiler warnings.)
+#      CC="$CC -migrate -w0 -verbose -warnprotos"
+#    fi
+#  ;;
+
 esac
 
 
+# Try and determine whether ${INSTALL} can create intermediate directories,
+# and if not, whether "mkdir -p" works instead.  This sets ${INSTALL_DIRS}.
+# (But autoconf should earn its keep and do this for us!)
+#
+AC_DEFUN(AC_PROG_INSTALL_DIRS,
+  [INSTALL_DIRS='${INSTALL} -d'
+   AC_MSG_CHECKING(whether \"\${INSTALL} -d\" creates intermediate directories)
+   rm -rf conftestdir
+   if mkdir conftestdir; then
+      cd conftestdir >&-
+
+      ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
+      if test -d dir1/dir2 ; then
+        AC_MSG_RESULT(yes)
+      else
+        AC_MSG_RESULT(no)
+        AC_MSG_CHECKING(whether \"mkdir -p\" creates intermediate directories)
+        rm -rf dir1
+        mkdir -p dir1/dir2 >&- 2>&-
+        if test -d dir1/dir2/. ; then
+         AC_MSG_RESULT(yes)
+         INSTALL_DIRS='mkdir -p'
+        else
+         AC_MSG_RESULT(no)
+        fi
+      fi
+      cd .. >&-
+      rm -rf conftestdir
+   fi
+])
+
+
 AC_PROG_CPP
 AC_PROG_INSTALL
+AC_PROG_INSTALL_DIRS
 AC_PROG_MAKE_SET
 
 AC_C_CONST
@@ -137,11 +185,10 @@ AC_PATH_XTRA
 # Try and find the app-defaults directory.
 # It sucks that autoconf doesn't do this already...
 #
-AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,
-  [
+AC_DEFUN(AC_PATH_X_APP_DEFAULTS_XMKMF,[
   rm -fr conftestdir
   if mkdir conftestdir; then
-    cd conftestdir
+    cd conftestdir >&-
     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
     cat > Imakefile <<'EOF'
 acfindx:
@@ -151,12 +198,12 @@ EOF
       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
     fi
-    cd ..
+    cd .. >&-
     rm -fr conftestdir
   fi])
 
-AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,
-[  # Look for the directory under a standard set of common directories.
+AC_DEFUN(AC_PATH_X_APP_DEFAULTS_DIRECT,[
+  # Look for the directory under a standard set of common directories.
   # Check X11 before X11Rn because it's often a symlink to the current release.
   for ac_dir in                                        \
     /usr/X11/lib/app-defaults                  \
@@ -306,6 +353,65 @@ AC_DEFUN(AC_TRY_X_RUN, [
 
 
 
+# Usage: HANDLE_X_PATH_ARG([variable_name],
+#                         [--command-line-option],
+#                         [descriptive string])
+#
+# All of the --with options take three forms:
+#
+#   --with-foo (or --with-foo=yes)
+#   --without-foo (or --with-foo=no)
+#   --with-foo=/DIR
+#
+# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
+# a directory (string beginning with a slash) it checks to see whether
+# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
+# as appropriate.
+#
+AC_DEFUN(HANDLE_X_PATH_ARG, [
+   case "$[$1]" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     AC_MSG_CHECKING([for [$3] headers])
+     d=$[$1]/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       AC_MSG_RESULT($d)
+     else
+       AC_MSG_RESULT(not found ($d: no such directory))
+     fi
+
+     AC_MSG_CHECKING([for [$3] libs])
+     d=$[$1]/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       AC_MSG_RESULT($d)
+     else
+       AC_MSG_RESULT(not found ($d: no such directory))
+     fi
+
+     # replace the directory string with "yes".
+     [$1]_req="yes"
+     [$1]=$[$1]_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to [$2] must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+
+   # why is this necessary?
+   # if we don't do this, then "./configure --with-motif=/usr/local/lesstif"
+   # behaves as if "--with-zippy=/usr/local/lesstif" was also present!
+   withval=
+  ])
+
 
 
 # check for the HP XHPDisableReset server extension headers.
@@ -327,37 +433,112 @@ if test $ac_cv_xpointer != yes; then
 fi
 
 
+# Random special-cases for certain pathological OSes.  You know who you are.
+#
 case "$host" in
   *-hpux*)
-    # Thanks for not making xmkmf find this by default, you losers.
+
+    # The following arcana was gleaned from conversations with
+    # Eric Schwartz <erics@col.hp.com>:
+    #
+    # On HPUX 10.x, the parts of X that HP considers "standard" live in
+    # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
+    # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
+    # Also, there are symlinks from /usr/include/ and /usr/lib/ into
+    # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
+    # you don't need any -I or -L arguments.
+    #
+    # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
+    # are the same division as 10.x.  However, there are no symlinks to
+    # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
+    # arguments are always necessary.
+    #
+    # However, X11R6 was available on HPUX 9.x as a patch: if that
+    # patch was installed, then all of X11R6 went in to
+    # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
+    #
+    # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
+    # whether R5 was available as a patch; R6 undoubtedly was not.)
+    #
+    # So.  We try and use the highest numbered pair of
+    # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
+    # that are available.  We do not mix and match different versions
+    # of X.
+    #
+    # Questions I still don't know the answers to: (do you?)
+    #
+    #   * Does HPUX 10.x come with /usr/contrib/X11R6/ standard?  
+    #     Or does that need to be installed separately?
+    #
+    #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
+    #     /usr/contrib/X11R6/ could be installed as a patch, what was in
+    #     that contrib directory?  Did it contain so-called "standard"
+    #     X11R6, or did it include Xaw and Xmu as well?  If the former,
+    #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
+    #     be a situation where one had to reach into the R5 headers and
+    #     libs to find Xmu?  That is, must both R6 and R5 directories
+    #     be on the -I and -L lists in that case?
+    #
+    for version in X11R6 X11R5 X11R4 ; do
+      # if either pair of directories exists...
+      if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib ; then
+         # if contrib exists, use it...
+         if test -d /usr/contrib/$version/lib ; then
+           X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
+           X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
+         fi
+         # if the "standard" one exists, use it.
+         if test -d /usr/lib/$version ; then
+           X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
+           X_LIBS="$X_LIBS -L/usr/lib/$version"
+         fi
+         # since at least one of the pair exists, go no farther.
+         break
+      fi
+    done
+
+    # Now find Motif.  Thanks for not making xmkmf find this by
+    # default, you losers.
+    #
     if test -d /usr/lib/Motif1.2 ; then
-      X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
+      X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
+      X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
     elif test -d /usr/lib/Motif1.1 ; then
-      X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
+      X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
+      X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
+    fi
+
+    # Now let's check for the pseudo-standard locations for OpenGL and XPM.
+    #
+    if test -d /opt/Mesa/lib ; then
+      X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
+      X_LIBS="-L/opt/Mesa/lib $X_LIBS"
     fi
 
-    # This too.  You losers.
-    if test -d /usr/contrib/X11R6/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
-    elif test -d /usr/X11R6/include ; then
-      X_CFLAGS="-I/usr/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R6/lib $X_LIBS"
-    elif test -d /usr/contrib/X11R5/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
-    elif test -d /usr/X11R5/include ; then
-      X_CFLAGS="-I/usr/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R5/lib $X_LIBS"
+    if test -d /opt/xpm/lib/X11 ; then
+      X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
+      X_LIBS="-L/opt/xpm/lib/X11 $X_LIBS"
+    fi
+
+    # On HPUX, default to installing in /opt/xscreensaver/ instead of
+    # in /usr/local/, unless there is already an xscreensaver in
+    # /usr/local/bin/.  This can be overridden with the --prefix arg
+    # to configure.  I'm not sure this is the right thing to do, but
+    # Richard Lloyd says so...
+    #
+    if test \! -x /usr/local/bin/xscreensaver ; then
+      ac_default_prefix=/opt/xscreensaver
     fi
 
   ;;
   *-solaris*)
-    # Same to you, pinheads.  (Is this really the standard location now?
-    # What happened to the joke that this kind of thing went in /opt?)
+
+    # Thanks for not making xmkmf find this by default, pinheads.
+    # And thanks for moving things around again, too.  Is this
+    # really the standard location now?  What happened to the
+    # joke that this kind of thing went in /opt?
     # cthomp says "answer: CDE (Common Disorganized Environment)"
+    #
     if test -f /usr/dt/include/Xm/Xm.h ; then
       X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
       X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
@@ -428,13 +609,21 @@ fi
 #
 have_sgi=no
 with_sgi_req=unspecified
-AC_ARG_WITH(sgi-ext,[
+AC_ARG_WITH(sgi-ext,
+[Except where noted, all of the --with options below can also take a
+directory argument: for example, --with-motif=/opt/Motif.  That would
+cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
+to be added to the -L list, assuming those directories exist.
+
 X Server Extension options:
 
   --with-sgi-ext          Include support for the SGI SCREEN_SAVER
                           server extension, if possible (this is the default).
   --without-sgi-ext       Do not compile in support for this extension.],
   [with_sgi="$withval"; with_sgi_req="$withval"],[with_sgi=yes])
+
+HANDLE_X_PATH_ARG(with_sgi, --with-sgi-ext, SGI SCREEN_SAVER)
+
 if test $with_sgi = yes; then
   AC_CHECK_X_HEADER(X11/extensions/XScreenSaver.h,
                    [have_sgi=yes
@@ -455,6 +644,9 @@ AC_ARG_WITH(mit-ext,
                           server extension, if possible (this is the default).
   --without-mit-ext       Do not compile in support for this extension.],
   [with_mit="$withval"; with_mit_req="$withval"],[with_mit=yes])
+
+HANDLE_X_PATH_ARG(with_mit, --with-mit-ext, MIT-SCREEN-SAVER)
+
 if test $have_sgi != yes; then
   if test $with_mit = yes; then
     AC_CHECK_X_HEADER(X11/extensions/scrnsaver.h, [have_mit=yes])
@@ -505,6 +697,9 @@ AC_ARG_WITH(xidle-ext,
                           if possible (this is the default).
   --without-xidle-ext     Do not compile in support for this extension.],
   [with_xidle="$withval"; with_xidle_req="$withval"],[with_xidle=yes])
+
+HANDLE_X_PATH_ARG(with_xidle, --with-xidle-ext, XIDLE)
+
 if test $with_xidle = yes; then
   AC_CHECK_X_HEADER(X11/extensions/xidle.h,
                    [have_xidle=yes
@@ -524,6 +719,9 @@ AC_ARG_WITH(xshm-ext,
                           extension, if possible (this is the default).
   --without-xshm-ext      Do not compile in support for this extension.],
   [with_xshm="$withval"; with_xshm_req="$withval"],[with_xshm=yes])
+
+HANDLE_X_PATH_ARG(with_xshm, --with-xshm-ext, XSHM)
+
 if test $with_xshm = yes; then
 
   # first check for Xshm.h.
@@ -575,6 +773,9 @@ AC_ARG_WITH(sgivc-ext,
                           extension, if possible (this is the default).
   --without-sgivc-ext     Do not compile in support for this extension.],
   [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
+
+HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
+
 if test $with_sgivc = yes; then
 
   # first check for XSGIvc.h
@@ -608,6 +809,9 @@ AC_ARG_WITH(dpms-ext,
                           if possible (this is the default).
   --without-dpms-ext      Do not compile in support for this extension.],
   [with_dpms="$withval"; with_dpms_req="$withval"],[with_dpms=yes])
+
+HANDLE_X_PATH_ARG(with_dpms, --with-dpms-ext, DPMS)
+
 if test $with_dpms = yes; then
 
   # first check for dpms.h
@@ -644,17 +848,21 @@ with_athena_req=unspecified
 AC_ARG_WITH(motif,[
 X Client Toolkit options:
 
-  --with-motif            Use the Motif toolkit for the user interface,
-                          if possible (this is the default).
+  --with-motif            Use the Motif toolkit for the user interface, if
+                          possible (this is the default).
   --without-motif         Do not use Motif.],
   [with_motif="$withval"; with_motif_req="$withval"],[with_motif=no])
 
+HANDLE_X_PATH_ARG(with_motif, --with-motif, Motif)
+
 AC_ARG_WITH(athena,
 [  --with-athena           Use the Athena toolkit for the user interface, if
                           possible (this is the default if Motif isn't used.)
   --without-athena        Do not use Athena.],
   [with_athena="$withval"; with_athena_req="$withval"],[with_athena=no])
 
+HANDLE_X_PATH_ARG(with_athena, --with-athena, Athena)
+
 if test $with_motif != yes -a $with_motif != no ; then
   echo "error: must be yes or no: --with-motif=$with_motif"
   exit 1
@@ -772,22 +980,39 @@ if test $have_motif = yes ; then
   have_lesstif=$ac_cv_have_lesstif
 fi
 
-# don't cache this
-unset ac_cv_good_lesstif
+# don't cache these
+unset ac_cv_lesstif_version
+unset ac_cv_lesstif_version_string
+
+lesstif_version=unknown
+lesstif_version_string=unknown
 
-good_lesstif=no
 if test $have_lesstif = yes ; then
-  # It must be at least "GNU Lesstif 0.82".
-  # #### If you change this, also sync the warning message lower down.
-  AC_CACHE_CHECK([whether LessTif is of a recent enough vintage],
-                ac_cv_good_lesstif,
-                [AC_TRY_X_RUN([#include <Xm/Xm.h>
-                               int main() { exit(LesstifVersion < 82); }],
-                              [ac_cv_good_lesstif=yes],
-                              [ac_cv_good_lesstif=no],
-                              # cross compiling?  Make an ass out of umption.
-                              [ac_cv_good_lesstif=yes])])
-  good_lesstif=$ac_cv_good_lesstif
+  ltv=unknown
+  echo unknown > conftest-lt
+  AC_CACHE_CHECK([LessTif version number],
+                ac_cv_lesstif_version_string,
+      [AC_TRY_X_RUN([#include <stdio.h>
+                    #include <Xm/Xm.h>
+                    int main() {
+                      FILE *f = fopen("conftest-lt", "w");
+                      if (!f) exit(1);
+                      fprintf(f, "%d %d.%d\n", LesstifVersion,
+                         LESSTIF_VERSION, LESSTIF_REVISION);
+                      fclose(f);
+                      exit(0);
+                    }],
+                   [ltv=`cat conftest-lt`
+                    ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
+                    ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`],
+                   [ac_cv_lesstif_version=unknown
+                    ac_cv_lesstif_version_string=unknown],
+                   [ac_cv_lesstif_version=unknown
+                    ac_cv_lesstif_version_string=unknown])])
+  rm -f conftest-lt
+  lesstif_version=$ac_cv_lesstif_version
+  lesstif_version_string=$ac_cv_lesstif_version_string
+
 fi
 
 
@@ -815,6 +1040,9 @@ Graphics Demo options:
                           if possible (this is the default).
   --without-xpm           Do not compile in support for XPM files.],
   [with_xpm="$withval"; with_xpm_req="$withval"],[with_xpm=yes])
+
+HANDLE_X_PATH_ARG(with_xpm, --with-xpm, XPM)
+
 if test $with_xpm = yes; then
   AC_CHECK_X_HEADER(X11/xpm.h,
                   [have_xpm=yes
@@ -836,6 +1064,11 @@ AC_ARG_WITH(gl,
   --without-gl            Do not build the OpenGL demos.],
   [with_gl="$withval"; with_gl_req="$withval"],[with_gl=yes])
 
+HANDLE_X_PATH_ARG(with_gl, --with-gl, GL)
+
+ac_mesagl_version=unknown
+ac_mesagl_version_string=unknown
+
 if test $with_gl = yes; then
   AC_CHECK_X_HEADER(GL/gl.h, have_gl=yes, have_gl=no)
   if test $have_gl = yes ; then
@@ -847,14 +1080,71 @@ if test $with_gl = yes; then
   if test $have_gl = yes ; then
 
     AC_DEFINE(HAVE_GL)
-    have_mesa_gl=no
-    AC_EGREP_X_HEADER(Mesa, GL/glx.h, [have_mesa_gl=yes])
-    if test $have_mesa_gl = no ; then
+
+    # We need to know whether it's MesaGL so that we know which libraries
+    # to link against.
+    #
+    AC_MSG_CHECKING(whether GL is really MesaGL)
+    AC_CACHE_VAL(ac_cv_have_mesa_gl,
+      [ac_cv_have_mesa_gl=no
+       AC_EGREP_X_HEADER(Mesa, GL/glx.h, [ac_cv_have_mesa_gl=yes])
+      ])
+    ac_have_mesa_gl=$ac_cv_have_mesa_gl
+    AC_MSG_RESULT($ac_have_mesa_gl)
+
+    if test $ac_have_mesa_gl = no ; then
+      gl_lib_1="GL"
       GL_LIBS="-lGL -lGLU"
     else
       AC_DEFINE(HAVE_MESA_GL)
+      gl_lib_1="MesaGL"
       GL_LIBS="-lMesaGL -lMesaGLU"
     fi
+
+
+    # If it's MesaGL, we'd like to issue a warning if the version number
+    # is less than or equal to 2.6, because that version had a security bug.
+    #
+    if test $ac_have_mesa_gl = yes; then
+
+      # don't cache these.
+      unset ac_cv_mesagl_version
+      unset ac_cv_mesagl_version_string
+
+      AC_MSG_CHECKING(MesaGL version number)
+      AC_CACHE_VAL(ac_cv_mesagl_version_string,
+       [cat > conftest.$ac_ext <<EOF
+#line __oline__ "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+#configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
+EOF
+
+        mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | sed -n \
+             's/^#configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
+        if test "$mglv" = ""; then
+           ac_mesagl_version=unknown
+           ac_mesagl_version_string=unknown
+         else
+           ac_mesagl_version_string=$mglv
+           maj=`echo $mglv | sed -n 's/\..*//p'`
+           min=`echo $mglv | sed -n 's/.*\.//p'`
+           ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
+         fi
+         ac_cv_mesagl_version=$ac_mesagl_version
+         ac_cv_mesagl_version_string=$ac_mesagl_version_string
+      ])
+      ac_mesagl_version=$ac_cv_mesagl_version
+      ac_mesagl_version_string=$ac_cv_mesagl_version_string
+      AC_MSG_RESULT($ac_cv_mesagl_version_string)
+    fi
+
+
+    # Check for OpenGL 1.1 features.
+    #
+    AC_CHECK_X_LIB($gl_lib_1, glBindTexture, [AC_DEFINE(HAVE_GLBINDTEXTURE)],
+                  [], $GL_LIBS -lX11 -lXext -lm)
+
   fi
 
 elif test $with_gl != no; then
@@ -873,6 +1163,9 @@ AC_ARG_WITH(readdisplay,
   --without-readdisplay   Do not compile in support for this extension.],
   [with_readdisplay="$withval"; with_readdisplay_req="$withval"],
   [with_readdisplay=yes])
+
+HANDLE_X_PATH_ARG(with_readdisplay, --with-readdisplay, XReadDisplay)
+
 if test $with_readdisplay = yes; then
   AC_CHECK_X_HEADER(X11/extensions/readdisplay.h,
                    AC_DEFINE(HAVE_READ_DISPLAY_EXTENSION))
@@ -892,6 +1185,9 @@ AC_ARG_WITH(sgivideo,
   --without-sgivideo       Do not compile in support for this library.],
   [with_sgivideo="$withval"; with_sgivideo_req="$withval"],
   [with_sgivideo=yes])
+
+HANDLE_X_PATH_ARG(with_sgivideo, --with-sgivideo, Iris Video)
+
 if test $with_sgivideo = yes; then
   AC_CHECK_X_HEADER(dmedia/vl.h, have_sgivideo=yes)
   if test $have_sgivideo = yes; then
@@ -1079,6 +1375,9 @@ if test $enable_locking = yes; then
                           if possible (this is the default.)
   --without-kerberos      Do not compile in support for Kerberos.],
   [with_kerberos="$withval"; with_kerberos_req="$withval"],[with_kerberos=yes])
+
+  HANDLE_X_PATH_ARG(with_kerberos, --with-kerberos, Kerberos)
+
   if test $with_kerberos = yes; then
     AC_CACHE_CHECK([for Kerberos], ac_cv_kerberos,
                   [AC_TRY_X_COMPILE([#include <krb.h>],,
@@ -1087,7 +1386,14 @@ if test $enable_locking = yes; then
     if test $ac_cv_kerberos = yes ; then
       have_kerberos=yes
       AC_DEFINE(HAVE_KERBEROS)
-      PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
+
+      # from Tim Showalter <tjs+@andrew.cmu.edu>
+      PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
+      AC_CHECK_FUNC(res_search,,
+        AC_CHECK_LIB(resolv,res_search,PASSWD_LIBS="${PASSWD_LIBS} -lresolv",
+          AC_MSG_WARN([Can't find DNS resolver libraries needed for Kerberos])
+       ))
+
     fi
   elif test $with_kerberos != no; then
     echo "error: must be yes or no: --with-kerberos=$with_kerberos"
@@ -1103,6 +1409,9 @@ if test $enable_locking = yes; then
   --without-shadow        Do not compile in support for shadow passwords.
 ],
   [with_shadow="$withval"; with_shadow_req="$withval"],[with_shadow=yes])
+
+  HANDLE_X_PATH_ARG(with_shadow, --with-shadow, shadow password)
+
   if test $with_shadow = no; then
     passwd_cruft_done=yes
   elif test $with_shadow != yes; then
@@ -1285,9 +1594,6 @@ DEPEND_FLAGS=
 DEPEND_DEFINES=
 
 
-# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own...
-INSTALL_DIRS='$(INSTALL) -d'
-
 # Done testing things -- now substitute in some stuff for the Makefiles.
 #
 if test $have_motif = yes; then
@@ -1370,8 +1676,13 @@ AC_SUBST(DEPEND_DEFINES)
 
 # Print some warnings before emitting the Makefiles.
 #
+warn_prefix_1="    Warning:"
+warn_prefix_2="       Note:"
+warn_prefix="$warn_prefix_1"
+
 warning=no
 warnsep='    #################################################################'
+
 warnpre() {
   if test $warning = no ; then
     echo '' ; echo "$warnsep" ; echo ''
@@ -1383,7 +1694,7 @@ warn() {
   warnpre
   if test $warning = long ; then echo '' ; fi
   warning=yes
-  echo "    Warning: $@"
+  echo "$warn_prefix $@"
 }
 
 warnL() {
@@ -1391,7 +1702,7 @@ warnL() {
   warnpre
   warning=yes
   if test $was != no ; then echo '' ; fi
-  echo "    Warning: $@"
+  echo "$warn_prefix $@"
 }
 
 warn2() {
@@ -1399,6 +1710,19 @@ warn2() {
   warning=long
 }
 
+note() {
+  warn_prefix="$warn_prefix_2"
+  warn $@
+  warn_prefix="$warn_prefix_1"
+}
+
+noteL() {
+  warn_prefix="$warn_prefix_2"
+  warnL $@
+  warn_prefix="$warn_prefix_1"
+}
+
+
 if test $with_sgi_req = yes -a $have_sgi = no ; then
   warn 'The SGI saver extension was requested, but was not found.'
 fi
@@ -1438,12 +1762,28 @@ elif test $with_athena_req = yes -a $have_athena = no ; then
 fi
 
 if test $have_motif = yes -a $have_lesstif = yes ; then
-  if test $good_lesstif != yes ; then
-    warnL "Motif is being used, but it appears to actually be"
-    warn2 "LessTif, and the version number is less than 0.82!"
-    warn2 "Such old versions of LessTif are too buggy to use"
-    warn2 "with XScreenSaver; it is strongly recommended that"
-    warn2 "you upgrade!  See <http://www.lesstif.org/>."
+
+  preferred_lesstif=0.87
+
+  if test $lesstif_version = unknown; then
+    warnL "Unable to determine the LessTif version number!"
+    warn2 "Make sure you are using version $preferred_lesstif or newer."
+    warn2 "See <http://www.lesstif.org/>."
+
+  elif test \! $lesstif_version -gt 82; then
+    warnL "LessTif version $lesstif_version_string is being used."
+    warn2 "LessTif versions 0.82 and earlier are too buggy to"
+    warn2 "use with XScreenSaver; it is strongly recommended"
+    warn2 "that you upgrade to at least version $preferred_lesstif!"
+    warn2 "See <http://www.lesstif.org/>."
+
+  elif test \! $lesstif_version -gt 86; then
+    warnL "LessTif version $lesstif_version_string is being used."
+    warn2 "LessTif versions 0.86 and earlier have a bug that"
+    warn2 "can cause a security problem with xscreensaver."
+    warn2 "If you want to use xscreensaver as a screen locker,"
+    warn2 "it is strongly recommended that you upgrade to at"
+    warn2 "least version $preferred_lesstif.  See <http://www.lesstif.org/>."
   fi
 fi
 
@@ -1456,12 +1796,58 @@ if test $proselytize_motif = yes ; then
     warn2 "available as well: see <http://www.lesstif.org/>."
 fi
 
-if test $with_xpm_req = yes -a $have_xpm = no ; then
-  warn 'Use of XPM was requested, but it was not found.'
+
+if test $have_gl = yes -a $ac_have_mesa_gl = yes ; then
+  preferred_mesagl=2.7
+
+  if test $ac_mesagl_version = unknown; then
+    warnL "Unable to determine the MesaGL version number!"
+    warn2 "Make sure you are using version $preferred_mesagl or newer."
+
+  elif test \! $ac_mesagl_version -gt 2006; then
+    warnL "MesaGL version $ac_mesagl_version_string is being used."
+    warn2 "MesaGL versions 2.6 and earlier have a security bug."
+    warn2 "It is strongly recommended that you upgrade to at"
+    warn2 "least version $preferred_mesagl."
+  fi
+fi
+
+
+if test $have_xpm = no ; then
+  if test $with_xpm_req = yes ; then
+    warnL 'Use of XPM was requested, but it was not found.'
+  elif test $with_xpm_req = no ; then
+    noteL 'The XPM library is not being used.'
+  else
+    noteL 'The XPM library was not found.'
+  fi
+
+  echo ''
+  warn2 'Some of the demos will not be as colorful as they'
+  warn2 'could be.  You might want to consider installing XPM'
+  warn2 'and re-running configure.  (Remember to delete the'
+  warn2 'config.cache file first.)  You can find XPM at most'
+  warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
 fi
 
-if test $with_gl_req = yes -a $have_gl = no ; then
-  warn 'Use of GL was requested, but it was not found.'
+if test $have_gl = no ; then
+  if test $with_gl_req = yes ; then
+    warnL 'Use of GL was requested, but it was not found.'
+  elif test $with_gl_req = no ; then
+    noteL 'The OpenGL 3D library is not being used.'
+  else
+    noteL 'The OpenGL 3D library was not found.'
+  fi
+
+  echo ''
+  warn2 'Those demos which use 3D will not be built or installed.'
+  warn2 'You might want to consider installing OpenGL and'
+  warn2 're-running configure.  (Remember to delete the'
+  warn2 "config.cache file first.)  If your vendor doesn't ship"
+  warn2 'their own implementation of OpenGL, you can get a free'
+  warn2 'version at <http://www.ssec.wisc.edu/~brianp/Mesa.html>.'
+  warn2 'For general OpenGL info, see <http://www.opengl.org/>.'
+
 fi
 
 if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
@@ -1522,7 +1908,7 @@ echo '      When you run "make install", the "xscreensaver" and'
 echo '      "xscreensaver-command" executables will be installed in'
 echo "      ${bindir}."
 echo ""
-echo "      The various graphics demos (60+ different executables) will"
+echo "      The various graphics demos (80+ different executables) will"
 echo "      be installed in ${HACKDIR}."
 echo ""
 echo "      If you would prefer the demos to be installed elsewhere"
index 64e19587877e12b5367f5ee96259b39a7850246b..9c789a9f637f9d025dba865d693ca6c121f1f116 100644 (file)
@@ -48,6 +48,8 @@ X_EXTRA_LIBS  = @X_EXTRA_LIBS@
 # X_EXTRA_LIBS contains extra libraries needed by X that aren't a part of X.
 #         (e.g., -lsocket, -lnsl, etc.)
 #
+# I think (but am not totally sure) that LIBS is also really "LDFLAGS".
+#
 # SAVER_LIBS is the link line for "xscreensaver", and
 # CMD_LIBS is the link line for "xscreensaver-command".
 
@@ -75,6 +77,8 @@ KERBEROS_OBJS = kpasswd.o
 LOCK_SRCS_1    = lock.c
 LOCK_OBJS_1    = lock.o
 
+TEST_SRCS      = test-passwd.c test-uid.c
+
 DIALOG_SRCS    = @DIALOG_SRCS@
 DIALOG_OBJS    = @DIALOG_OBJS@
 PASSWD_SRCS    = @PASSWD_SRCS@
@@ -93,10 +97,10 @@ UTIL_OBJS   = $(UTILS_BIN)/fade.o $(UTILS_BIN)/overlay.o \
                  $(UTILS_BIN)/spline.o \
                  $(UTILS_BIN)/yarandom.o @XMU_OBJS@
 
-SAVER_SRCS_1   = demo.c stderr.c subprocs.c timers.c windows.c \
-                 xscreensaver.c xset.c
-SAVER_OBJS_1   = demo.o stderr.o subprocs.o timers.o windows.o \
-                 xscreensaver.o xset.o
+SAVER_SRCS_1   = demo.c stderr.c subprocs.c setuid.c timers.c windows.c \
+                 xscreensaver.c splash.c xset.c
+SAVER_OBJS_1   = demo.o stderr.o subprocs.o setuid.o timers.o windows.o \
+                 xscreensaver.o splash.o xset.o
 
 SAVER_SRCS     = $(SAVER_SRCS_1) $(DIALOG_SRCS) $(LOCK_SRCS) $(UTIL_SRCS)
 SAVER_OBJS     = $(SAVER_OBJS_1) $(DIALOG_OBJS) $(LOCK_OBJS) $(UTIL_OBJS)
@@ -104,9 +108,9 @@ SAVER_OBJS  = $(SAVER_OBJS_1) $(DIALOG_OBJS) $(LOCK_OBJS) $(UTIL_OBJS)
 CMD_SRCS       = xscreensaver-command.c
 CMD_OBJS       = xscreensaver-command.o
 
-SAVER_LIBS     = $(X_LIBS) $(X_PRE_LIBS) @SAVER_LIBS@ -lXt   \
-                 -lX11 -lXext $(X_EXTRA_LIBS) $(PASSWD_LIBS) \
-                 $(LIBS)
+SAVER_LIBS     = $(LIBS) $(X_LIBS) @SAVER_LIBS@ \
+                 $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) \
+                 $(PASSWD_LIBS)
 
 CMD_LIBS       = $(X_LIBS) $(X_PRE_LIBS)      \
                  -lX11 -lXext $(X_EXTRA_LIBS) \
@@ -123,7 +127,7 @@ VMSFILES    = compile_axp.com compile_decc.com link_axp.com link_decc.com \
 
 TARFILES       = $(EXTRAS) $(VMSFILES) $(SAVER_SRCS_1) \
                  $(MOTIF_SRCS) $(ATHENA_SRCS) $(PWENT_SRCS) $(KERBEROS_SRCS) \
-                 $(LOCK_SRCS_1) $(CMD_SRCS) $(HDRS) $(MEN)
+                 $(LOCK_SRCS_1) $(CMD_SRCS) $(HDRS) $(TEST_SRCS) $(MEN)
 
 
 all: $(EXES)
@@ -136,7 +140,8 @@ install-strip:
                INSTALL_SETUID='$(INSTALL_SETUID) -s' \
                install
 
-install-program:
+install-program: $(EXES)
+       @if [ ! -d $(bindir) ]; then $(INSTALL_DIRS) $(bindir) ; fi
        @inst="$(INSTALL_PROGRAM)" ;                                    \
        if [ @NEED_SETUID@ = yes ]; then                                \
           me="`whoami`" ;                                              \
@@ -156,16 +161,15 @@ install-program:
  $$e ""                                                                             ;\
           fi ;                                                         \
        fi ;                                                            \
-       if [ ! -d $(bindir) ]; then $(INSTALL_DIRS) $(bindir) ; fi ;    \
        echo $$inst xscreensaver $(bindir)/xscreensaver ;               \
        $$inst xscreensaver $(bindir)/xscreensaver
        $(INSTALL_PROGRAM) xscreensaver-command $(bindir)/xscreensaver-command
 
-install-ad:
-       @if [ ! -d $(AD_DIR) ]; then $(INSTALL_DIRS) $(AD_DIR) ; fi ;   \
+install-ad: XScreenSaver.ad
+       @if [ ! -d $(AD_DIR) ]; then $(INSTALL_DIRS) $(AD_DIR) ; fi
        $(INSTALL_DATA) XScreenSaver.ad $(AD_DIR)/XScreenSaver
 
-install-man:
+install-man: $(MEN)
        @men="$(MEN)" ;                                                 \
        if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ;  \
        for man in $$men; do                                            \
@@ -195,7 +199,7 @@ clean:
        -rm -f *.o a.out core $(EXES) XScreenSaver_ad.h
 
 distclean: clean
-       -rm -f Makefile XScreenSaver.ad *~ "#"*
+       -rm -f Makefile XScreenSaver.ad TAGS *~ "#"*
 
 # Adds all current dependencies to Makefile
 depend: XScreenSaver_ad.h
@@ -317,7 +321,7 @@ xscreensaver-command: $(CMD_OBJS)
 
 
 TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PWENT_OBJS) $(DIALOG_OBJS) \
-        subprocs.o demo.o \
+        subprocs.o setuid.o demo.o \
        $(UTIL_OBJS)
 
 test-passwd: $(TEST_PASSWD_OBJS)
@@ -326,6 +330,7 @@ test-passwd: $(TEST_PASSWD_OBJS)
 ##############################################################################
 #
 # DO NOT DELETE: updated by make distdepend
+# $(srcdir)/DO $(srcdir)/NOT $(srcdir)/DELETE: $(srcdir)/updated $(srcdir)/by $(srcdir)/make $(srcdir)/distdepend
 
 demo.o: ../config.h
 demo.o: $(srcdir)/xscreensaver.h
@@ -337,6 +342,8 @@ stderr.o: $(UTILS_SRC)/visual.h
 subprocs.o: ../config.h
 subprocs.o: $(srcdir)/xscreensaver.h
 subprocs.o: $(UTILS_SRC)/yarandom.h
+setuid.o: ../config.h
+setuid.o: $(srcdir)/xscreensaver.h
 timers.o: ../config.h
 timers.o: $(srcdir)/xscreensaver.h
 windows.o: ../config.h
@@ -350,6 +357,9 @@ xscreensaver.o: $(UTILS_SRC)/yarandom.h
 xscreensaver.o: $(UTILS_SRC)/resources.h
 xscreensaver.o: $(UTILS_SRC)/visual.h
 xscreensaver.o: XScreenSaver_ad.h
+splash.o: ../config.h
+splash.o: $(srcdir)/xscreensaver.h
+splash.o: $(UTILS_SRC)/visual.h
 xset.o: ../config.h
 xset.o: $(srcdir)/xscreensaver.h
 dialogs-Xm.o: ../config.h
index 7c29cd789b81c14dd0fba65f59237d96fdffce96..932dead42c8a38300d8c74eb0df364059e21576e 100644 (file)
@@ -4,11 +4,11 @@
 !            a screen saver and locker for the X window system
 !                            by Jamie Zawinski
 !
-!                              version 2.24
-!                                30-Jun-98
+!                              version 2.31
+!                                02-Oct-98
 !
 ! See "man xscreensaver" for more info.  The latest version is always
-! available at http://people.netscape.com/jwz/xscreensaver/
+! available at http://www.jwz.org/xscreensaver/
 
 *timeout:              10
 *cycle:                        10
@@ -22,6 +22,8 @@
 *unfade:               False
 *fadeSeconds:          3
 *fadeTicks:            20
+*splash:               True
+*splashDuration:       5
 
 *captureStderr:        True
 *captureStdout:        True
 *overlayStderr:                True
 *font:                 *-medium-r-*-140-*-m-*
 
+! This is the URL that the "Help" button on the splash screen loads.
+*helpURL: http://www.jwz.org/xscreensaver/man.html
+
+! This is how the "Help" button loads URLs (in /bin/sh syntax.)
+*loadURL: netscape -remote 'openURL(%s)' || netscape '%s' &
+
+
 ! Turning on "installColormap" interacts erratically with twm and tvtwm,
 ! but seems to work fine with mwm and olwm.  Try it and see.  If your
 ! screen turns some color other than black, the window manager is buggy,
 @GL_KLUDGE_2@  pipes -root                                             \n\
 @GL_KLUDGE_2@  sproingies -root                                        \n\
 @GL_KLUDGE_2@  rubik -root                                             \n\
-@GL_KLUDGE_2@  atlantis -root                                          \n
+@GL_KLUDGE_2@  atlantis -root                                          \n\
+@GL_KLUDGE_2@  lament -root                                            \n\
+@GL_KLUDGE_2@  bubble3d -root                                          \n
  
 
 ! A few of the hacks require OpenGL, and will only be built if you have it.
 *passwdDialog*fontList:          *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1
 *XmTextField.fontList:             *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1
 *passwdDialog.passwdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1
+*splashDialog*fontList:                   *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1
+*splashDialog*splashLabel1.fontList:   *-times-bold-r-*-*-*-180-*-*-*-iso8859-1
+*splashDialog*splashLabel2.fontList:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1
+*splashDialog*splashLabel3.fontList:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1
 XScreenSaver*XmList.fontList:      *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1
 ! Need to fully-qualify the preceeding in the case of of *sgiMode.
 
@@ -300,8 +315,8 @@ XScreenSaver*XmDialogShell*rogerLabel.background:   #FFFFFF
 
 *label1.labelString:           XScreenSaver %s
 *label1.label:                 XScreenSaver %s
-*label2.labelString: Copyright Â© 1991-1998 by Jamie Zawinski <jwz@netscape.com>
-*label2.label:      Copyright Â© 1991-1998 by Jamie Zawinski <jwz@netscape.com>
+*label2.labelString: Copyright Â© 1991-1998 by Jamie Zawinski <jwz@jwz.org>
+*label2.label:      Copyright Â© 1991-1998 by Jamie Zawinski <jwz@jwz.org>
 *demoList.visibleItemCount:    10
 *demoList.automaticSelection:  True
 *next.labelString:             Run Next
@@ -340,6 +355,21 @@ XScreenSaver*XmDialogShell*rogerLabel.background:  #FFFFFF
 *passwdLabel3.alignment:       ALIGNMENT_BEGINNING
 *rogerLabel.width:             150
 
+*splashDialog.title:           XScreenSaver
+*splashLabel1.labelString:     XScreenSaver %s
+*splashLabel2.labelString:     Copyright Â© 1991-1998 by
+*splashLabel3.labelString:     Jamie Zawinski <jwz@jwz.org>
+*splashDemo.labelString:       Demo
+*splashPrefs.labelString:      Prefs
+*splashDialog*Help.labelString:        Help
+
+*splashLabel1.alignment:       ALIGNMENT_CENTER
+*splashLabel2.alignment:       ALIGNMENT_CENTER
+*splashLabel3.alignment:       ALIGNMENT_CENTER
+
+*splashDialog.borderWidth:     1
+*splashForm.shadowThickness:   4
+
 ! Disable Motif drag-and-drop in dialog boxes.  This is kind of pathetic, but
 ! in some older versions of Motif, most any attempt to drag cause immediate
 ! flaming death from above.  This *should* rip the legs off that bug.
@@ -354,6 +384,10 @@ XScreenSaver*dragReceiverProtocolStyle:  DRAG_NONE
 *demo_dialog*font:             *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1
 *resources_dialog*font:                *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1
 *passwd_dialog*font:           *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1
+*splash_dialog*font:           *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1
+*splash_dialog*splashLabel1.font:   *-times-bold-r-*-*-*-180-*-*-*-iso8859-1
+*splash_dialog*splashLabel2.font:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1
+*splash_dialog*splashLabel3.font:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1
 *demo_dialog*label1.font:      *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1
 *resources_dialog*label1.font: *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1
 XScreenSaver.demo_dialog*List.font: \
@@ -384,6 +418,13 @@ XScreenSaver.passwd_dialog*Text*background:                #FFFFFF
 XScreenSaver.passwd_dialog*roger.foreground:           #CD0000
 XScreenSaver.passwd_dialog*roger.background:           #FFFFFF
 
+XScreenSaver.splash_dialog*foreground:                 #000000
+XScreenSaver.splash_dialog*background:                 #E5E5E5
+XScreenSaver.splash_dialog*Command.background:         #D9D9D9
+XScreenSaver.splash_dialog*Text*background:            #FFFFFF
+XScreenSaver.splash_dialog*roger.foreground:           #CD0000
+XScreenSaver.splash_dialog*roger.background:           #FFFFFF
+
 *demo_dialog*viewport.height:                  200
 *Form.borderWidth:                             0
 *Box.borderWidth:                              0
@@ -427,6 +468,25 @@ XScreenSaver.demo_dialog*Command.internalHeight: 4
 *passwd_dialog*roger.height:                   150
 *passwd_dialog*roger.borderWidth:              1
 
+*splash_dialog*splashLabel1.label:             XScreenSaver %s
+*splash_dialog*splashLabel2.label:             Copyright Â© 1991-1998 by
+*splash_dialog*splashLabel3.label:             Jamie Zawinski <jwz@jwz.org>
+*splash_dialog*splash_form*label.label:                
+*splash_dialog*Dialog.label:                   
+*splash_dialog*splash_form.borderWidth:                0
+*splash_dialog*roger.width:                    150
+*splash_dialog*roger.height:                   150
+*splash_dialog*roger.borderWidth:              1
+*splash_dialog*demo.label:                     Demo
+*splash_dialog*prefs.label:                    Prefs
+*splash_dialog*help.label:                     Help
+*splash_dialog.box.defaultDistance:            0
+*splash_dialog*splashLabel1.internalHeight:    10
+*splash_dialog*splashLabel1.internalWidth:     10
+*splash_dialog*splashLabel2.internalHeight:    0
+*splash_dialog*splashLabel3.internalHeight:    0
+
+
 
 ! You probably won't need to change these.  They are only used if no server
 ! extension is in use.
index 315208e2db9982f36fc7f666f2768762cff2178e..bb83d0fb9c252e97b176c82024c4fb801f59201e 100644 (file)
 "*unfade:              False",
 "*fadeSeconds:         3",
 "*fadeTicks:           20",
+"*splash:              True",
+"*splashDuration:      5",
 "*captureStderr:       True",
 "*captureStdout:       True",
 "*overlayTextForeground:       #FFFF00",
 "*overlayTextBackground:       #000000",
 "*overlayStderr:               True",
 "*font:                        *-medium-r-*-140-*-m-*",
+"*helpURL: http://www.jwz.org/xscreensaver/man.html",
+"*loadURL: netscape -remote 'openURL(%s)' || netscape '%s' &",
 "*installColormap:     True",
 "*programs:    qix -root -solid -delay 0 -segments 100                 \\n\
                attraction -root -mode balls                            \\n\
                pipes -root                                             \\n\
                sproingies -root                                        \\n\
                rubik -root                                             \\n\
-               atlantis -root                                          \\n",
+               atlantis -root                                          \\n\
+               lament -root                                            \\n\
+               bubble3d -root                                          \\n",
 " ",
 "*fontList:                       *-helvetica-medium-r-*-*-*-120-*-*-*-iso8859-1",
 "*demoDialog*label1.fontList:     *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1",
 "*passwdDialog*fontList:          *-helvetica-medium-r-*-*-*-140-*-*-*-iso8859-1",
 "*XmTextField.fontList:             *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1",
 "*passwdDialog.passwdText.fontList: *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1",
+"*splashDialog*fontList:                  *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1",
+"*splashDialog*splashLabel1.fontList:   *-times-bold-r-*-*-*-180-*-*-*-iso8859-1",
+"*splashDialog*splashLabel2.fontList:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1",
+"*splashDialog*splashLabel3.fontList:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1",
 "XScreenSaver*XmList.fontList:      *-courier-medium-r-*-*-*-120-*-*-*-iso8859-1",
 "*XmDialogShell*foreground:            #000000",
 "*XmDialogShell*background:            #E5E5E5",
 "*demoDialog.maxWidth:         600",
 "*label1.labelString:          XScreenSaver %s",
 "*label1.label:                        XScreenSaver %s",
-"*label2.labelString: Copyright Â© 1991-1998 by Jamie Zawinski <jwz@netscape.com>",
-"*label2.label:             Copyright Â© 1991-1998 by Jamie Zawinski <jwz@netscape.com>",
+"*label2.labelString: Copyright Â© 1991-1998 by Jamie Zawinski <jwz@jwz.org>",
+"*label2.label:             Copyright Â© 1991-1998 by Jamie Zawinski <jwz@jwz.org>",
 "*demoList.visibleItemCount:   10",
 "*demoList.automaticSelection: True",
 "*next.labelString:            Run Next",
 "*passwdLabel2.alignment:      ALIGNMENT_BEGINNING",
 "*passwdLabel3.alignment:      ALIGNMENT_BEGINNING",
 "*rogerLabel.width:            150",
+"*splashDialog.title:          XScreenSaver",
+"*splashLabel1.labelString:    XScreenSaver %s",
+"*splashLabel2.labelString:    Copyright Â© 1991-1998 by",
+"*splashLabel3.labelString:    Jamie Zawinski <jwz@jwz.org>",
+"*splashDemo.labelString:      Demo",
+"*splashPrefs.labelString:     Prefs",
+"*splashDialog*Help.labelString:       Help",
+"*splashLabel1.alignment:      ALIGNMENT_CENTER",
+"*splashLabel2.alignment:      ALIGNMENT_CENTER",
+"*splashLabel3.alignment:      ALIGNMENT_CENTER",
+"*splashDialog.borderWidth:    1",
+"*splashForm.shadowThickness:  4",
 "XScreenSaver*dragInitiatorProtocolStyle: DRAG_NONE",
 "XScreenSaver*dragReceiverProtocolStyle:  DRAG_NONE",
 "*demo_dialog*font:            *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1",
 "*resources_dialog*font:               *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1",
 "*passwd_dialog*font:          *-helvetica-bold-r-*-*-*-120-*-*-*-iso8859-1",
+"*splash_dialog*font:          *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1",
+"*splash_dialog*splashLabel1.font:   *-times-bold-r-*-*-*-180-*-*-*-iso8859-1",
+"*splash_dialog*splashLabel2.font:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1",
+"*splash_dialog*splashLabel3.font:   *-times-bold-r-*-*-*-140-*-*-*-iso8859-1",
 "*demo_dialog*label1.font:     *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1",
 "*resources_dialog*label1.font:        *-helvetica-bold-r-*-*-*-140-*-*-*-iso8859-1",
 "XScreenSaver.demo_dialog*List.font: \
 "XScreenSaver.passwd_dialog*Text*background:           #FFFFFF",
 "XScreenSaver.passwd_dialog*roger.foreground:          #CD0000",
 "XScreenSaver.passwd_dialog*roger.background:          #FFFFFF",
+"XScreenSaver.splash_dialog*foreground:                        #000000",
+"XScreenSaver.splash_dialog*background:                        #E5E5E5",
+"XScreenSaver.splash_dialog*Command.background:                #D9D9D9",
+"XScreenSaver.splash_dialog*Text*background:           #FFFFFF",
+"XScreenSaver.splash_dialog*roger.foreground:          #CD0000",
+"XScreenSaver.splash_dialog*roger.background:          #FFFFFF",
 "*demo_dialog*viewport.height:                 200",
 "*Form.borderWidth:                            0",
 "*Box.borderWidth:                             0",
 "*passwd_dialog*roger.width:                   150",
 "*passwd_dialog*roger.height:                  150",
 "*passwd_dialog*roger.borderWidth:             1",
+"*splash_dialog*splashLabel1.label:            XScreenSaver %s",
+"*splash_dialog*splashLabel2.label:            Copyright Â© 1991-1998 by",
+"*splash_dialog*splashLabel3.label:            Jamie Zawinski <jwz@jwz.org>",
+"*splash_dialog*splash_form*label.label:               ",
+"*splash_dialog*Dialog.label:                  ",
+"*splash_dialog*splash_form.borderWidth:               0",
+"*splash_dialog*roger.width:                   150",
+"*splash_dialog*roger.height:                  150",
+"*splash_dialog*roger.borderWidth:             1",
+"*splash_dialog*demo.label:                    Demo",
+"*splash_dialog*prefs.label:                   Prefs",
+"*splash_dialog*help.label:                    Help",
+"*splash_dialog.box.defaultDistance:           0",
+"*splash_dialog*splashLabel1.internalHeight:   10",
+"*splash_dialog*splashLabel1.internalWidth:    10",
+"*splash_dialog*splashLabel2.internalHeight:   0",
+"*splash_dialog*splashLabel3.internalHeight:   0",
 "XScreenSaver.pointerPollTime:         5",
 "XScreenSaver.initialDelay:            0",
 "XScreenSaver.windowCreationTimeout:   30",
index 10a177efbf258d2939d9b3dc400e21428f489c0c..99ea27cb9089160be219e7fb4ca9db947f8d40c3 100644 (file)
@@ -1,5 +1,5 @@
 /* demo.c --- implements the interactive demo-mode and options dialogs.
- * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -15,6 +15,7 @@
 #endif
 
 #include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
 
 /* We don't actually use any widget internals, but these are included
    so that gdb will have debug info for the widgets... */
@@ -30,7 +31,6 @@
 #else  /* HAVE_ATHENA */
   /* Athena demo code contributed by Jon A. Christopher <jac8782@tamu.edu> */
   /* Copyright 1997, with the same permissions as above. */
-# include <X11/StringDefs.h>
 # include <X11/Shell.h>
 # include <X11/Xaw/Form.h>
 # include <X11/Xaw/Box.h>
 #include <string.h>
 #include <ctype.h>
 
+#ifdef _VROOT_H_
+ERROR!  You must not include vroot.h in this file.
+#endif
+
 static void demo_mode_hack (saver_info *si, char *);
 static void demo_mode_done (saver_info *si);
 
@@ -67,6 +71,8 @@ extern Widget lock_time_text, passwd_time_text;
 extern Widget verbose_toggle, cmap_toggle, fade_toggle, unfade_toggle,
   lock_toggle;
 
+extern Widget splash_dialog;
+
 
 #ifdef HAVE_MOTIF
 
@@ -216,8 +222,13 @@ static void
 text_cb (Widget text_widget, XtPointer client_data, XtPointer call_data)
 {
   saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
   char *line;
   line = get_text_string (text_widget);
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: processing text \"%s\".\n", blurb(), line);
+
   demo_mode_hack (si, line);
 }
 
@@ -273,19 +284,6 @@ select_cb (Widget button, XtPointer client_data, XtPointer call_data)
 }
 
 
-#if 0  /* configure does this now */
-#ifdef HAVE_ATHENA
-# if !defined(_Viewport_h)
-   /* The R4 Athena libs don't have this function.  I don't know the right
-      way to tell, but I note that the R5 version of Viewport.h defines
-      _XawViewport_h, while the R4 version defines _Viewport_h.  So we'll
-     try and key off of that... */
-#  define HAVE_XawViewportSetCoordinates
-# endif
-#endif /* HAVE_ATHENA */
-#endif /* 0 */
-
-
 /* Why this behavior isn't automatic in *either* toolkit, I'll never know.
  */
 static void
@@ -373,7 +371,12 @@ static void
 next_cb (Widget button, XtPointer client_data, XtPointer call_data)
 {
   saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
 
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Run Next\n", blurb());
+
+  {
 #ifdef HAVE_ATHENA
   int cnt;
   XawListReturnStruct *current = XawListShowCurrent(demo_list);
@@ -418,6 +421,7 @@ next_cb (Widget button, XtPointer client_data, XtPointer call_data)
   demo_mode_hack (si, get_text_string (text_line));
 
 #endif /* HAVE_MOTIF */
+  }
 }
 
 
@@ -425,7 +429,12 @@ static void
 prev_cb (Widget button, XtPointer client_data, XtPointer call_data)
 {
   saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Run Previous\n", blurb());
 
+  {
 #ifdef HAVE_ATHENA
   XawListReturnStruct *current=XawListShowCurrent(demo_list);
   if (current->list_index == XAW_LIST_NONE)
@@ -463,6 +472,7 @@ prev_cb (Widget button, XtPointer client_data, XtPointer call_data)
   demo_mode_hack (si, get_text_string (text_line));
 
 #endif /* HAVE_MOTIF */
+  }
 }
 
 
@@ -474,7 +484,12 @@ edit_cb (Widget button, XtPointer client_data, XtPointer call_data)
 {
   saver_info *si = (saver_info *) client_data;
   saver_screen_info *ssi = si->default_screen;
+  saver_preferences *p = &si->prefs;
   Widget parent = ssi->toplevel_shell;
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Preferences\n", blurb());
+
   if (! resources_dialog)
     make_resources_dialog (si, parent);
   pop_resources_dialog (si);
@@ -492,6 +507,9 @@ static void
 restart_cb (Widget button, XtPointer client_data, XtPointer call_data)
 {
   saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Restart\n", blurb());
   demo_mode_restart_process (si);
 }
 
@@ -547,6 +565,10 @@ pop_up_dialog_box (Widget dialog, Widget form, int where)
       x = (sw + w) / 2 - w;
       y = (sh + h) / 2 - h;
       break;
+    case 3:    /* center it in the top 2/3rds of the screen */
+      x = (sw + w) / 2 - w;
+      y = (sh*2/3 + h) / 2 - h;
+      break;
     default:
       abort ();
     }
@@ -570,7 +592,8 @@ pop_up_dialog_box (Widget dialog, Widget form, int where)
   XtManageChild (form);
 #endif /* HAVE_MOTIF */
 
-  steal_focus_and_colormap (dialog);
+  if (dialog != splash_dialog)
+    steal_focus_and_colormap (dialog);
 }
 
 
@@ -687,7 +710,7 @@ make_screenhack_dialog (saver_info *si)
     /* Why isn't the viewport getting centered? */
     XtVaGetValues(viewport,
                  XtNx, &x, XtNy, &y, XtNheight, &h, XtNborderWidth, &bw, 0);
-    printf("%d %d %d %d\n", x, y, w, h);
+/*    printf("%d %d %d %d\n", x, y, w, h); */
     XtConfigureWidget(viewport, x, y, w2-x-x, h, bw);
 
     /* And the text line, too. */
@@ -792,9 +815,15 @@ res_bool_cb (Widget button, XtPointer client_data, XtPointer call_data)
 static void
 res_cancel_cb (Widget button, XtPointer client_data, XtPointer call_data)
 {
+  saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
+
   XtDestroyWidget (resources_dialog);
   resources_dialog = 0;
   raise_screenhack_dialog ();
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: lowering preferences dialog.\n", blurb());
 }
 
 
@@ -974,6 +1003,9 @@ pop_resources_dialog (saver_info *si)
   saver_preferences *p = &si->prefs;
   char buf [100];
 
+  if (p->verbose_p)
+    fprintf (stderr, "%s: raising preferences dialog.\n", blurb());
+
   res.timeout = p->timeout / 1000;
   res.cycle = p->cycle / 1000;
   res.lock_time = p->lock_timeout / 1000;
@@ -1016,10 +1048,19 @@ void
 demo_mode (saver_info *si)
 {
   saver_preferences *p = &si->prefs;
+  Bool prefs_p = (si->demo_mode_p == (Bool) 2);  /* kludge! */
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Demo Mode.\n", blurb());
+
   si->dbox_up_p = True;
   monitor_power_on (si);
   raise_window (si, True, False, False);
   make_screenhack_dialog (si);
+
+  if (prefs_p)
+    edit_cb (0, si, 0);                /* pop up preferences panel */
+
   while (si->demo_mode_p)
     {
       XEvent event;
@@ -1041,10 +1082,11 @@ demo_mode (saver_info *si)
              start_notice_events_timer (si, event.xcreatewindow.window);
 #ifdef DEBUG_TIMERS
              if (p->verbose_p)
-               printf ("%s: starting notice_events_timer for 0x%X (%lu)\n",
-                       blurb(),
-                       (unsigned int) event.xcreatewindow.window,
-                       p->notice_events_timeout);
+               fprintf (stderr,
+                        "%s: starting notice_events_timer for 0x%X (%lu)\n",
+                        blurb(),
+                        (unsigned int) event.xcreatewindow.window,
+                        p->notice_events_timeout);
 #endif /* DEBUG_TIMERS */
            }
          break;
@@ -1077,9 +1119,18 @@ demo_mode (saver_info *si)
          break;
        }
     }
+
+  if (p->verbose_p)
+    fprintf (stderr, "%s: Demo Mode done.\n", blurb());
+
+  kill_screenhack (si);
+
   destroy_screenhack_dialogs (si);
   initialize_screensaver_window (si);
 
+  si->dbox_up_p = False;
+  si->demo_hack = 0;
+
   si->demo_mode_p = True;  /* kludge to inhibit unfade... */
   unblank_screen (si);
   si->demo_mode_p = False;
@@ -1100,10 +1151,5 @@ demo_mode_hack (saver_info *si, char *hack)
 static void
 demo_mode_done (saver_info *si)
 {
-  kill_screenhack (si);
-  if (si->demo_hack)
-    unblank_screen (si);
   si->demo_mode_p = False;
-  si->dbox_up_p = False;
-  si->demo_hack = 0;
 }
index 1555544bb10a44d9b3ad201d165cd6572762beae..2487754da3739723bd71eb4027fdae923363b5c5 100644 (file)
@@ -1,5 +1,5 @@
 /* dialogs-Xaw.c --- Athena widgets for demo, options, and password dialogs.
- * xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -73,6 +73,14 @@ Widget done;
 Widget restart;
 /*Widget spacer;*/
 
+Widget splash_dialog;
+Widget splash_form;
+Widget splash_roger_label;
+Widget splash_label1;
+Widget splash_label3;
+Widget splash_demo;
+Widget splash_prefs;
+Widget splash_help;
 
 static Widget buttonbox, textbox, okbox;
 
@@ -322,3 +330,63 @@ create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
   restart = XtVaCreateManagedWidget("restart", commandWidgetClass, box, NULL);
   done = XtVaCreateManagedWidget("done", commandWidgetClass, box, NULL);
 }
+
+
+void
+create_splash_dialog(Widget parent, Visual *visual, Colormap colormap)
+{
+  Widget box, splash_label2;
+  int depth = visual_depth(XtScreen(parent), visual);
+
+  splash_dialog = 
+    XtVaCreatePopupShell("splash_dialog", transientShellWidgetClass, parent,
+                        XtNtitle, NULL,
+                        XtNoverrideRedirect, TRUE,
+                        XtNvisual, visual,
+                        XtNcolormap, colormap,
+                        XtNdepth, depth,
+                        NULL);
+
+  box = XtVaCreateManagedWidget("box", formWidgetClass, splash_dialog,
+                               XtNleft, XtChainLeft,
+                               XtNright, XtChainRight,
+                               XtNtop, XtChainTop,
+                               XtNbottom, XtChainBottom,
+                               XtNvisual, visual,
+                               XtNcolormap, colormap,
+                               XtNdepth, depth,
+                               NULL);
+
+  splash_roger_label = XtVaCreateManagedWidget("roger", labelWidgetClass, box,
+                                              XtNlabel, "",
+                                              XtNleft, XtChainLeft,
+                                              XtNright, XtChainRight,
+                                              XtNtop, XtChainTop,
+                                              NULL);
+
+  splash_label1 = XtVaCreateManagedWidget("splashLabel1", labelWidgetClass,
+                                         box,
+                                         XtNfromHoriz, splash_roger_label,
+                                         XtNright, XtChainRight,
+                                         XtNtop, XtChainTop,
+                                         NULL);
+  splash_label2 = XtVaCreateManagedWidget("splashLabel2", labelWidgetClass,
+                                         box,
+                                         XtNfromHoriz, splash_roger_label,
+                                         XtNright, XtChainRight,
+                                         XtNfromVert, splash_label1,
+                                         NULL);
+  splash_label3 = XtVaCreateManagedWidget("splashLabel3", labelWidgetClass,
+                                         box,
+                                         XtNfromHoriz, splash_roger_label,
+                                         XtNright, XtChainRight,
+                                         XtNfromVert, splash_label2,
+                                         NULL);
+  
+  splash_form =
+    XtVaCreateManagedWidget("splash_form", dialogWidgetClass, box,
+                           XtNfromHoriz, splash_roger_label,
+                           XtNright, XtChainRight,
+                           XtNfromVert, splash_label3,
+                           NULL);
+}
index 0daa7b352ba9484fdf9ff0e095049aadbf0bf7dd..5a5d73e80babf80c4d7e1f8e087a8f047ca3946c 100644 (file)
@@ -1,5 +1,5 @@
 /* dialogs-Xm.c --- Motif widgets for demo, options, and password dialogs.
- * xscreensaver, Copyright (c) 1993-1997 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -80,6 +80,14 @@ Widget done;
 Widget restart;
 Widget spacer;
 
+Widget splash_dialog;
+Widget splash_form;
+Widget splash_roger_label;
+Widget splash_label1;
+Widget splash_label3;
+Widget splash_demo;
+Widget splash_prefs;
+Widget splash_help;
 
 void
 create_passwd_dialog(Widget parent, Visual *visual, Colormap colormap)
@@ -699,3 +707,133 @@ create_demo_dialog(Widget parent, Visual *visual, Colormap colormap)
 
   demo_form = real_dialog;
 }
+
+
+void
+create_splash_dialog(Widget parent, Visual *visual, Colormap colormap)
+{
+  Widget shell;
+  Widget  form1;
+  Widget   roger;
+  Widget   dialog;
+  Widget    form2;
+  Widget     label1, label2, label3;
+  Widget    demo, prefs, help;
+  Widget w;
+  Arg al[64];
+  int ac = 0;
+
+  ac = 0;
+  XtSetArg (al[ac], XmNvisual, visual); ac++;
+  XtSetArg (al[ac], XmNcolormap, colormap); ac++;
+  XtSetArg (al[ac], XmNdepth, visual_depth(XtScreen(parent), visual)); ac++;
+
+  shell = XmCreateDialogShell (parent, "splashDialog", al, ac);
+
+  form1 = XmCreateForm (shell, "form", 0, 0);
+
+  roger = XmCreateDrawnButton (form1, "rogerLabel", 0, 0);
+
+  dialog = XmCreateSelectionBox (form1, "splashForm", al, ac);
+
+  form2 = XmCreateForm ( dialog, "form", 0, 0);
+  label1 = XmCreateLabel ( form2, "splashLabel1", 0, 0);
+  label2 = XmCreateLabel ( form2, "splashLabel2", 0, 0);
+  label3 = XmCreateLabel ( form2, "splashLabel3", 0, 0);
+
+  ac = 0;
+  XtSetArg(al[ac], XmNtraversalOn, False); ac++;
+
+  demo = XmCreatePushButton (dialog, "splashDemo", al, ac);
+  prefs = XmCreatePushButton (dialog, "splashPrefs", al, ac);
+  help = XmSelectionBoxGetChild (dialog, XmDIALOG_HELP_BUTTON);
+  XtSetValues(help, al, ac);
+
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_OK_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_CANCEL_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_TEXT);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_LIST);
+  if (w) XtUnmanageChild (XtParent(w));
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_SELECTION_LABEL);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_SEPARATOR);
+  if (w) XtUnmanageChild (w);
+  w = XmSelectionBoxGetChild (dialog, XmDIALOG_APPLY_BUTTON);
+  if (w) XtUnmanageChild (w);
+
+  XtVaSetValues(label1,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_NONE,
+               0);
+  XtVaSetValues(label2,
+               XmNtopAttachment, XmATTACH_WIDGET,
+               XmNtopWidget, label1,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_NONE,
+               0);
+  XtVaSetValues(label3,
+               XmNtopAttachment, XmATTACH_WIDGET,
+               XmNtopWidget, label2,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+
+  XtVaSetValues(roger,
+               XmNsensitive, FALSE,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_FORM,
+               XmNrightAttachment, XmATTACH_NONE,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+  XtVaSetValues(dialog,
+               XmNtopAttachment, XmATTACH_FORM,
+               XmNleftAttachment, XmATTACH_WIDGET,
+               XmNleftWidget, roger,
+               XmNrightAttachment, XmATTACH_FORM,
+               XmNbottomAttachment, XmATTACH_FORM,
+               0);
+
+  XtManageChild(label1);
+  XtManageChild(label2);
+  XtManageChild(label3);
+
+  XtManageChild(form2);
+  XtManageChild(demo);
+  XtManageChild(prefs);
+  XtManageChild(help);
+
+  XtManageChild(roger);
+  XtManageChild(dialog);
+
+  {
+    Dimension width = 0, height = 0;
+    XtRealizeWidget(form1);
+    XtVaGetValues(roger, XmNwidth, &width, XmNheight, &height, 0);
+    if (width == height)
+      ;
+    else if (width > height)
+      XtVaSetValues(roger, XmNwidth, width, XmNheight, width, 0);
+    else
+      XtVaSetValues(roger, XmNwidth, height, XmNheight, height, 0);
+  }
+
+  splash_dialog = shell;
+  splash_form = form1;
+  splash_roger_label = roger;
+  splash_label1 = label1;
+  splash_label3 = label3;
+  splash_demo = demo;
+  splash_prefs = prefs;
+  splash_help = help;
+}
index ad1f6da00461b97e356f92b5d245259f8fac3989..8acdb35c107eeef6ed843abecacd21bfa029388d 100644 (file)
@@ -424,7 +424,7 @@ object 'label1' : XmLabel {
 object 'label2' : XmLabel {
        arguments {
        name = 'label2';
-       XmNlabelString= 'Copyright Â© 1991-1994 by Jamie Zawinski <jwz@netscape.com>';
+       XmNlabelString= 'Copyright Â© 1991-1994 by Jamie Zawinski <jwz@jwz.org>';
        };
 };
 object 'text_area' : XmScrolledList {
index ee11521336ab215c51c60499307b73e6062cc156..91ae343b980c013375956e7dcdf42d5081d83a90 100644 (file)
@@ -1,6 +1,6 @@
 /* kpasswd.c --- verify kerberos passwords.
  * written by Nat Lanza (magus@cs.cmu.edu) for
- * xscreensaver, Copyright (c) 1993-1997 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1993-1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 25dad5546e555e7e0a41387b0ccf7afa31318ccf..f388c0d61deeceffdc560032f7ed85a88e854280 100644 (file)
@@ -1,5 +1,5 @@
 /* lock.c --- handling the password dialog for locking-mode.
- * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -49,6 +49,10 @@ extern int validate_user(char *name, char *password);
 
 #endif /* HAVE_MOTIF */
 
+#ifdef _VROOT_H_
+ERROR!  You must not include vroot.h in this file.
+#endif
+
 extern Widget passwd_dialog;
 extern Widget passwd_form;
 extern Widget roger_label;
@@ -165,16 +169,16 @@ static XtActionsRec actions[] = {{"keypress",  keypress},
           for all keys anyway.  So, the implementation of keypress()
           has BackSpace, etc, hardcoded into it instead.  FMH!
         */
-static char translations[] = ("<Key>BackSpace: backspace()\n"
+static char translations[] =  "<Key>BackSpace: backspace()\n"
                              "<Key>Delete:     backspace()\n"
                              "Ctrl<Key>H:      backspace()\n"
                              "Ctrl<Key>U:      kill_line()\n"
                              "Ctrl<Key>X:      kill_line()\n"
                              "Ctrl<Key>J:      done()\n"
                              "Ctrl<Key>M:      done()\n"
-                             "<Key>:           keypress()\n");
+                             "<Key>:           keypress()\n";
 # else  /* !0 */
-static char translations[] = ("<Key>:          keypress()\n");
+static char translations[] =  "<Key>:          keypress()\n";
 # endif /* !0 */
 
 
@@ -272,45 +276,6 @@ done (Widget w, XEvent *event, String *argv, Cardinal *argc)
 #endif /* HAVE_ATHENA || !VERIFY_CALLBACK_WORKS */
 
 
-extern void skull (Display *, Window, GC, GC, int, int, int, int);
-
-static void
-roger (Widget button, XtPointer client_data, XtPointer call_data)
-{
-  Display *dpy = XtDisplay (button);
-  Screen *screen = XtScreen (button);
-  Window window = XtWindow (button);
-  Arg av [10];
-  int ac = 0;
-  XGCValues gcv;
-  Colormap cmap;
-  GC draw_gc, erase_gc;
-  unsigned int fg, bg;
-  int x, y, size;
-  XWindowAttributes xgwa;
-  XGetWindowAttributes (dpy, window, &xgwa);
-  cmap = xgwa.colormap;
-  if (xgwa.width > xgwa.height) size = xgwa.height;
-  else size = xgwa.width;
-  if (size > 40) size -= 30;
-  x = (xgwa.width - size) / 2;
-  y = (xgwa.height - size) / 2;
-  XtSetArg (av [ac], XtNforeground, &fg); ac++;
-  XtSetArg (av [ac], XtNbackground, &bg); ac++;
-  XtGetValues (button, av, ac);
-  /* if it's black on white, swap it cause it looks better (hack hack) */
-  if (fg == BlackPixelOfScreen (screen) && bg == WhitePixelOfScreen (screen))
-    fg = WhitePixelOfScreen (screen), bg = BlackPixelOfScreen (screen);
-  gcv.foreground = bg;
-  erase_gc = XCreateGC (dpy, window, GCForeground, &gcv);
-  gcv.foreground = fg;
-  draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
-  XFillRectangle (dpy, window, erase_gc, 0, 0, xgwa.width, xgwa.height);
-  skull (dpy, window, draw_gc, erase_gc, x, y, size, size);
-  XFreeGC (dpy, draw_gc);
-  XFreeGC (dpy, erase_gc);
-}
-
 static void
 make_passwd_dialog (saver_info *si)
 {
@@ -424,6 +389,8 @@ passwd_idle_timer (XtPointer closure, XtIntervalId *id)
       XtVaGetValues(passwd_done,
                    XmNheight, &h,
                    XmNy, &y,
+                   0);
+      XtVaGetValues(passwd_form,
                    XtNforeground, &fg,
                    XtNbackground, &bg,
                    XmNtopShadowColor, &ts,
@@ -505,6 +472,7 @@ pop_passwd_dialog (saver_info *si)
   Window focus;
   int revert_to;
   int i;
+  Window grab_window = RootWindowOfScreen(si->screens[0].screen);
 
   typed_passwd [0] = 0;
   passwd_state = pw_read;
@@ -567,13 +535,32 @@ pop_passwd_dialog (saver_info *si)
     roger(roger_label, 0, 0);
 #endif /* HAVE_ATHENA */
 
+
+  /* Make sure the mouse cursor is visible.
+     Since the screensaver was already active, we had already called
+     grab_keyboard_and_mouse() with our "invisible" Cursor object.
+     Now we need to change that.  (cursor == 0 means "server default
+     cursor.")
+   */
+  if (grab_window != si->mouse_grab_window ||
+      grab_window != si->keyboard_grab_window)
+    fprintf(stderr,
+           "%s: WARNING: expected mouse and keyboard grabs on 0x%x,\n"
+           "\tbut mouse-grab is 0x%x and keyboard-grab is 0x%x.\n",
+           blurb(),
+           (unsigned long) grab_window,
+           (unsigned long) si->mouse_grab_window,
+           (unsigned long) si->keyboard_grab_window);
+
+  if (p->verbose_p)
+    fprintf(stderr, "%s: re-grabbing keyboard and mouse to expose cursor.\n",
+           blurb());
+  grab_keyboard_and_mouse (si, grab_window, 0);
+
+
   if (!si->prefs.debug_p)
     XGrabServer (dpy);                         /* ############ DANGER! */
 
-  /* this call to ungrab used to be in main_loop() - see comment in
-      xscreensaver.c around line 857. */
-  ungrab_keyboard_and_mouse (si);
-
   while (passwd_state == pw_read)
     {
       XEvent event;
@@ -586,6 +573,15 @@ pop_passwd_dialog (saver_info *si)
   XUngrabServer (dpy);
   XSync (dpy, False);                          /* ###### (danger over) */
 
+
+  /* Now turn off the mouse cursor again.
+   */
+  if (p->verbose_p)
+    fprintf(stderr, "%s: re-grabbing keyboard and mouse to hide cursor.\n",
+           blurb());
+  grab_keyboard_and_mouse (si, grab_window, si->screens[0].cursor);
+
+
   if (passwd_state != pw_time)
     XtRemoveTimeOut (passwd_idle_id);
 
index b0a4b8ad10d8af638aa9a800cd3cf86ed4527c20..d331b3bb26d17e52f31ce0b4dbfd7025604374fd 100644 (file)
@@ -1,5 +1,5 @@
 /* passwd.c --- verifying typed passwords with the OS.
- * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #ifndef VMS
 # include <pwd.h>
+# include <grp.h>
 #else /* VMS */
 # include "vms-pwd.h"
 #endif /* VMS */
@@ -170,7 +171,7 @@ get_encrypted_passwd(const char *user)
     }
 
   fprintf (stderr, "%s: couldn't get password of \"%s\"\n",
-          progname, (user ? user : "(null)"));
+          blurb(), (user ? user : "(null)"));
 
   return 0;
 }
@@ -236,5 +237,4 @@ passwd_valid_p (const char *typed_passwd)
 Bool lock_init (int argc, char **argv) { return True; }
 #endif /* VMS */
 
-
 #endif /* NO_LOCKING -- whole file */
diff --git a/driver/setuid.c b/driver/setuid.c
new file mode 100644 (file)
index 0000000..87bb4c3
--- /dev/null
@@ -0,0 +1,215 @@
+/* setuid.c --- management of runtime priveleges.
+ * xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifndef NO_SETUID /* whole file */
+
+#include <X11/Xlib.h>          /* not used for much... */
+
+/* This file doesn't need the Xt headers, so stub these types out... */
+#undef XtPointer
+#define XtAppContext void*
+#define XrmDatabase  void*
+#define XtIntervalId void*
+#define XtPointer    void*
+#define Widget       void*
+
+#include "xscreensaver.h"
+
+#ifndef EPERM
+#include <errno.h>
+#endif
+
+#include <pwd.h>               /* for getpwnam() and struct passwd */
+#include <grp.h>               /* for getgrgid() and struct group */
+
+
+static const char *
+uid_gid_string(uid_t uid, gid_t gid)
+{
+  static char buf[255];
+  struct passwd *p = 0;
+  struct group *g = 0;
+  p = getpwuid (uid);
+  g = getgrgid (gid);
+  sprintf (buf, "%s/%s (%ld/%ld)",
+          (p && p->pw_name ? p->pw_name : "???"),
+          (g && g->gr_name ? g->gr_name : "???"),
+          (long) uid, (long) gid);
+  return buf;
+}
+
+
+void
+describe_uids (saver_info *si, FILE *out)
+{
+  uid_t uid = getuid();
+  gid_t gid = getgid();
+  uid_t euid = geteuid();
+  gid_t egid = getegid();
+  char *s1 = strdup (uid_gid_string (uid, gid));
+  char *s2 = strdup (uid_gid_string (euid, egid));
+
+  if (si->orig_uid && *si->orig_uid)
+    fprintf (out, "%s: initial effective uid/gid was %s\n", blurb(),
+            si->orig_uid);
+  fprintf (out, "%s: running as %s", blurb(), s1);
+  if (uid != euid || gid != egid)
+    fprintf (out, "; effectively %s", s2);
+  fprintf(out, "\n");
+  free(s1);
+  free(s2);
+}
+
+
+/* If we've been run as setuid or setgid to someone else (most likely root)
+   turn off the extra permissions so that random user-specified programs
+   don't get special privileges.  (On some systems it is necessary to install
+   this program as setuid root in order to read the passwd file to implement
+   lock-mode.)
+ */
+void
+hack_uid (saver_info *si)
+{
+  si->orig_uid = strdup (uid_gid_string (geteuid(), getegid()));
+
+  setgid (getgid ());
+  setuid (getuid ());
+
+  /* If we're being run as root (as from xdm) then switch the user id
+     to something safe. */
+  if (getuid () == 0)
+    {
+      struct passwd *p = 0;
+      struct group *g = 0;
+      int uid_errno = 0;
+      int gid_errno = 0;
+
+      /* Locking can't work when running as root, because we have no way of
+        knowing what the user id of the logged in user is (so we don't know
+        whose password to prompt for.)
+       */
+      si->locking_disabled_p = True;
+      si->nolock_reason = "running as root";
+      p = getpwnam ("nobody");
+      if (! p) p = getpwnam ("noaccess");
+      if (! p) p = getpwnam ("daemon");
+      if (! p)
+       {
+         fprintf (stderr,
+                  "%s: running as root, and couldn't find a safer uid.\n",
+                  blurb());
+         saver_exit(si, 1, 0);
+       }
+
+      g = getgrgid (p->pw_gid);
+
+      /* Rumor has it that some implementations of of setuid() do nothing
+        when called with -1; therefore, if the "nobody" user has a uid of
+        -1, then that would be Really Bad.  Rumor further has it that such
+        systems really ought to be using -2 for "nobody", since that works.
+        So, if we get a uid (or gid, for good measure) of -1, switch to -2
+        instead.
+       */
+
+      if (p->pw_gid == -1) p->pw_gid = -2;
+      if (p->pw_uid == -1) p->pw_uid = -2;
+
+
+      /* Change the gid to be a safe one, then change the uid to be a safe
+        one (must do it in this order, because root privs vanish when uid
+        is changed, and after that, gid can't be changed.)
+       */
+      if (setgid (p->pw_gid) != 0)
+       gid_errno = errno ? errno : -1;
+      if (setuid (p->pw_uid) != 0)
+       uid_errno = errno ? errno : -1;
+
+      if (uid_errno == 0 && gid_errno == 0)
+       {
+         static char buf [1024];
+         sprintf (buf, "changed uid/gid to %s/%s (%ld/%ld).",
+                  p->pw_name, (g ? g->gr_name : "???"),
+                  (long) p->pw_uid, (long) p->pw_gid);
+         si->uid_message = buf;
+       }
+      else
+       {
+         char buf [1024];
+         if (gid_errno)
+           {
+             sprintf (buf, "%s: couldn't set gid to %s (%ld)",
+                      blurb(),
+                      (g ? g->gr_name : "???"),
+                      (long) p->pw_gid);
+             if (gid_errno == -1)
+               fprintf(stderr, "%s: unknown error\n", buf);
+             else
+               perror(buf);
+           }
+
+         if (uid_errno)
+           {
+             sprintf (buf, "%s: couldn't set uid to %s (%ld)",
+                      blurb(),
+                      (p ? p->pw_name : "???"),
+                      (long) p->pw_uid);
+             if (uid_errno == -1)
+               fprintf(stderr, "%s: unknown error\n", buf);
+             else
+               perror(buf);
+           }
+       }
+
+      if (uid_errno != 0)
+       {
+         /* We'd better exit rather than continue running as root.
+            But if we switched uid but not gid, continue running,
+            since that doesn't really matter.  (Right?)
+          */
+         saver_exit (si, -1, 0);
+       }
+    }
+# ifndef NO_LOCKING
+ else  /* disable locking if already being run as "someone else" */
+   {
+     struct passwd *p = getpwuid (getuid ());
+     if (!p ||
+        !strcmp (p->pw_name, "root") ||
+        !strcmp (p->pw_name, "nobody") ||
+        !strcmp (p->pw_name, "noaccess") ||
+        !strcmp (p->pw_name, "operator") ||
+        !strcmp (p->pw_name, "daemon") ||
+        !strcmp (p->pw_name, "bin") ||
+        !strcmp (p->pw_name, "adm") ||
+        !strcmp (p->pw_name, "sys") ||
+        !strcmp (p->pw_name, "games"))
+       {
+        static char buf [1024];
+        sprintf (buf, "running as %s", p->pw_name);
+        si->nolock_reason = buf;
+        si->locking_disabled_p = True;
+       }
+   }
+# endif /* !NO_LOCKING */
+}
+
+#else  /* !NO_SETUID */
+
+void hack_uid (saver_info *si) { }
+void hack_uid_warn (saver_info *si) { }
+void describe_uids (saver_info *si) { }
+
+#endif /* NO_SETUID */
diff --git a/driver/splash.c b/driver/splash.c
new file mode 100644 (file)
index 0000000..630c44d
--- /dev/null
@@ -0,0 +1,245 @@
+/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+
+#ifdef HAVE_MOTIF
+# include <Xm/Xm.h>
+
+#else  /* HAVE_ATHENA */
+# include <X11/Shell.h>
+# include <X11/Xaw/Form.h>
+# include <X11/Xaw/Box.h>
+# include <X11/Xaw/Command.h>
+# include <X11/Xaw/Dialog.h>
+#endif /* HAVE_ATHENA */
+
+#include "xscreensaver.h"
+#include "visual.h"
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+extern void skull (Display *, Window, GC, GC, int, int, int, int);
+
+void
+roger (Widget button, XtPointer client_data, XtPointer call_data)
+{
+  Display *dpy = XtDisplay (button);
+  Screen *screen = XtScreen (button);
+  Window window = XtWindow (button);
+  Arg av [10];
+  int ac = 0;
+  XGCValues gcv;
+  Colormap cmap;
+  GC draw_gc, erase_gc;
+  unsigned int fg, bg;
+  int x, y, size;
+  XWindowAttributes xgwa;
+  XGetWindowAttributes (dpy, window, &xgwa);
+  cmap = xgwa.colormap;
+  if (xgwa.width > xgwa.height) size = xgwa.height;
+  else size = xgwa.width;
+  if (size > 40) size -= 30;
+  x = (xgwa.width - size) / 2;
+  y = (xgwa.height - size) / 2;
+  XtSetArg (av [ac], XtNforeground, &fg); ac++;
+  XtSetArg (av [ac], XtNbackground, &bg); ac++;
+  XtGetValues (button, av, ac);
+  /* if it's black on white, swap it cause it looks better (hack hack) */
+  if (fg == BlackPixelOfScreen (screen) && bg == WhitePixelOfScreen (screen))
+    fg = WhitePixelOfScreen (screen), bg = BlackPixelOfScreen (screen);
+  gcv.foreground = bg;
+  erase_gc = XCreateGC (dpy, window, GCForeground, &gcv);
+  gcv.foreground = fg;
+  draw_gc = XCreateGC (dpy, window, GCForeground, &gcv);
+  XFillRectangle (dpy, window, erase_gc, 0, 0, xgwa.width, xgwa.height);
+  skull (dpy, window, draw_gc, erase_gc, x, y, size, size);
+  XFreeGC (dpy, draw_gc);
+  XFreeGC (dpy, erase_gc);
+}
+
+
+static Widget splash_shell;
+extern Widget splash_dialog;
+extern Widget splash_form;
+extern Widget splash_roger_label;
+extern Widget splash_label1;
+extern Widget splash_label3;
+extern Widget splash_demo;
+extern Widget splash_prefs;
+extern Widget splash_help;
+
+static void
+splash_sink(saver_info *si)
+{
+  if (si->splash_dialog)
+    {
+      XtDestroyWidget(si->splash_dialog);
+      XtDestroyWidget(splash_shell);
+      si->splash_dialog = 0;
+      splash_shell = 0;
+    }
+}
+
+static void
+splash_sink_timer (XtPointer closure, XtIntervalId *id)
+{
+  saver_info *si = (saver_info *) closure;
+  splash_sink(si);
+}
+
+
+static void
+send_self_clientmessage (saver_info *si, Atom command)
+{
+  Display *dpy = si->dpy;
+  Window window = si->default_screen->screensaver_window;
+  XEvent event;
+  event.xany.type = ClientMessage;
+  event.xclient.display = si->dpy;
+  event.xclient.window = window;
+  event.xclient.message_type = XA_SCREENSAVER;
+  event.xclient.format = 32;
+  event.xclient.data.l[0] = (long) command;
+  if (! XSendEvent (dpy, window, False, 0L, &event))
+    fprintf (stderr, "%s: XSendEvent(dpy, 0x%x ...) failed.\n",
+            progname, (unsigned int) window);
+}
+
+static void
+splash_demo_cb (Widget button, XtPointer client_data, XtPointer call_data)
+{
+  saver_info *si = (saver_info *) client_data;
+  splash_sink(si);
+  send_self_clientmessage (si, XA_DEMO);
+}
+
+static void
+splash_prefs_cb (Widget button, XtPointer client_data, XtPointer call_data)
+{
+  saver_info *si = (saver_info *) client_data;
+  splash_sink(si);
+  send_self_clientmessage (si, XA_PREFS);
+}
+
+static void
+splash_help_cb (Widget button, XtPointer client_data, XtPointer call_data)
+{
+  saver_info *si = (saver_info *) client_data;
+  saver_preferences *p = &si->prefs;
+
+  splash_sink(si);
+
+  if (!p->help_url || !*p->help_url)
+    fprintf(stderr, "%s: no Help URL has been specified.\n");
+  else if (!p->load_url_command || !*p->load_url_command)
+    fprintf(stderr, "%s: no URL-loading command has been specified.\n");
+  else
+    {
+      char *buf = (char *) malloc (strlen(p->load_url_command) +
+                                  (strlen(p->help_url) * 2) + 10);
+      sprintf(buf, p->load_url_command, p->help_url, p->help_url);
+      system(buf);
+    }
+}
+
+static void
+make_splash_dialog (saver_info *si)
+{
+  saver_screen_info *ssi = si->default_screen;
+  Visual *v = DefaultVisualOfScreen(ssi->screen);
+
+  /* The splash dialog must always be created on the default visual and
+     with the default colormap, so that it shows up in the right colors
+     when viewed along with the rest of the desktop.  The other xscreensaver
+     dialogs don't have this constraint, since they are only seen when the
+     blackout window is also exposed.
+
+     To accomplish this, we need our own ApplicationShell, since the shell
+     in si->default_screen->toplevel_shell might have a non-default visual.
+   */
+  splash_shell = XtVaAppCreateShell (progname, progclass,
+                                    applicationShellWidgetClass,
+                                    si->dpy,
+                                    XtNscreen, ssi->screen,
+                                    XtNvisual, v,
+                                    XtNdepth,  visual_depth(ssi->screen, v),
+                                    0);
+
+  create_splash_dialog (splash_shell, v,
+                       DefaultColormapOfScreen (ssi->screen));
+  si->splash_dialog = splash_dialog; /* gaaah... */
+
+#ifdef HAVE_ATHENA
+  XawDialogAddButton(splash_form,"demo",  splash_demo_cb, si);
+  XawDialogAddButton(splash_form,"prefs", splash_prefs_cb, si);
+  XawDialogAddButton(splash_form,"help",  splash_help_cb, si);
+  splash_demo  = XtNameToWidget(splash_form,"demo");
+  splash_prefs = XtNameToWidget(splash_form,"prefs");
+  splash_help  = XtNameToWidget(splash_form,"help");
+
+  /* Lose the label on the inner dialog. */
+  {
+    Widget w = XtNameToWidget(splash_form, "label");
+    if (w) XtUnmanageChild(w);
+  }
+
+#else  /* HAVE_MOTIF */
+  /* Another random thing necessary in 1.2.1 but not 1.1.5... */
+  XtVaSetValues (splash_roger_label, XmNborderWidth, 1, 0);
+
+  XtAddCallback (splash_demo, XmNactivateCallback, splash_demo_cb, si);
+  XtAddCallback (splash_prefs, XmNactivateCallback, splash_prefs_cb, si);
+  XtAddCallback (splash_help, XmNactivateCallback, splash_help_cb, si);
+  XtAddCallback (splash_roger_label, XmNexposeCallback, roger, si);
+
+#endif /* HAVE_MOTIF */
+
+  format_into_label (splash_label1, si->version);
+
+  XtRealizeWidget(splash_dialog);
+}
+
+void
+pop_splash_dialog (saver_info *si)
+{
+  XtIntervalId splash_sink_id;
+
+  if (si->prefs.splash_duration <= 0)
+    return;
+
+  if (! si->splash_dialog)
+    make_splash_dialog (si);
+
+#ifdef HAVE_ATHENA
+  splash_form = splash_dialog; /* kludge */
+#endif
+
+  pop_up_dialog_box (splash_dialog, splash_form,
+                    /* for debugging -- don't ask */
+                    (si->prefs.debug_p ? 69 : 0) +
+                    3);
+  XtManageChild (splash_form);
+
+#ifdef HAVE_ATHENA
+  if (splash_roger_label)
+    roger (splash_roger_label, 0, 0);
+#endif /* HAVE_ATHENA */
+
+  splash_sink_id = XtAppAddTimeOut (si->app, si->prefs.splash_duration,
+                                   splash_sink_timer, (XtPointer) si);
+}
index 0743a50e799e58733c2510615001cfb30b5455f5..798d4efb3cdb546bf342fe388ac00a8982c38afb 100644 (file)
@@ -1,5 +1,5 @@
 /* stderr.c --- capturing stdout/stderr output onto the screensaver window.
- * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 1876f83290d06c624e085a134bb2fe009f5825e9..166ae5996f573b5e7a4a24d04497268362b83676 100644 (file)
@@ -1,6 +1,6 @@
 /* subprocs.c --- choosing, spawning, and killing screenhacks.
  * xscreensaver, Copyright (c) 1991, 1992, 1993, 1995, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 
 #include <signal.h>            /* for the signal names */
 
-#ifndef NO_SETUID
-#include <pwd.h>               /* for getpwnam() and struct passwd */
-#include <grp.h>               /* for getgrgid() and struct group */
-#endif /* NO_SETUID */
-
 #if !defined(SIGCHLD) && defined(SIGCLD)
 #define SIGCHLD SIGCLD
 #endif
@@ -256,9 +251,9 @@ exec_screenhack (saver_info *si, const char *command)
   Bool hairy_p = !!strpbrk (command, "*?$&!<>[];`'\\\"");
 
   if (p->verbose_p)
-    printf ("%s: spawning \"%s\" in pid %lu%s.\n",
-           blurb(), command, (unsigned long) getpid (),
-           (hairy_p ? " (via shell)" : ""));
+    fprintf (stderr, "%s: spawning \"%s\" in pid %lu%s.\n",
+            blurb(), command, (unsigned long) getpid (),
+            (hairy_p ? " (via shell)" : ""));
 
   if (hairy_p)
     /* If it contains any shell metacharacters, do it the hard way,
@@ -270,7 +265,8 @@ exec_screenhack (saver_info *si, const char *command)
 
 #else /* VMS */
   if (p->verbose_p)
-    printf ("%s: spawning \"%s\" in pid %lu.\n", blurb(), command, getpid());
+    fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n",
+            blurb(), command, getpid());
   exec_vms_command (command);
 #endif /* VMS */
 
@@ -612,8 +608,8 @@ describe_dead_child (saver_info *si, pid_t kid, int wait_status)
                 "%s: child pid %lu (%s) exited abnormally (code %d).\n",
                 blurb(), (unsigned long) kid, name, exit_status);
       else if (p->verbose_p)
-       printf ("%s: child pid %lu (%s) exited normally.\n",
-               blurb(), (unsigned long) kid, name);
+       fprintf (stderr, "%s: child pid %lu (%s) exited normally.\n",
+                blurb(), (unsigned long) kid, name);
 
       if (job)
        job->status = job_dead;
@@ -826,7 +822,7 @@ spawn_screenhack_1 (saver_screen_info *ssi, Bool first_time_p)
          sprintf (buf, "%s: couldn't fork", blurb());
          perror (buf);
          restore_real_vroot (si);
-         saver_exit (si, 1);
+         saver_exit (si, 1, 0);
 
        case 0:
          close (ConnectionNumber (si->dpy));   /* close display fd */
@@ -853,8 +849,9 @@ spawn_screenhack (saver_info *si, Bool first_time_p)
   if (!monitor_powered_on_p (si))
     {
       if (si->prefs.verbose_p)
-       printf ("%s: server reports that monitor has powered down; "
-               "not launching a new hack.\n", blurb());
+       fprintf (stderr,
+                "%s: server reports that monitor has powered down; "
+                "not launching a new hack.\n", blurb());
       return;
     }
 
@@ -1038,132 +1035,3 @@ hack_environment (saver_info *si)
     }
 #endif /* HAVE_PUTENV && DEFAULT_PATH_PREFIX */
 }
-
-
-\f
-/* Change the uid/gid of the screensaver process, so that it is safe for it
-   to run setuid root (which it needs to do on some systems to read the 
-   encrypted passwords from the passwd file.)
-
-   hack_uid() is run before opening the X connection, so that XAuth works.
-   hack_uid_warn() is called after the connection is opened and the command
-   line arguments are parsed, so that the messages from hack_uid() get 
-   printed after we know whether we're in `verbose' mode.
- */
-
-#ifndef NO_SETUID
-
-static int hack_uid_errno;
-static char hack_uid_buf [255], *hack_uid_error;
-
-void
-hack_uid (saver_info *si)
-{
-
-  /* If we've been run as setuid or setgid to someone else (most likely root)
-     turn off the extra permissions so that random user-specified programs
-     don't get special privileges.  (On some systems it might be necessary
-     to install this as setuid root in order to read the passwd file to
-     implement lock-mode...)
-  */
-  setgid (getgid ());
-  setuid (getuid ());
-
-  hack_uid_errno = 0;
-  hack_uid_error = 0;
-
-  /* If we're being run as root (as from xdm) then switch the user id
-     to something safe. */
-  if (getuid () == 0)
-    {
-      struct passwd *p;
-      /* Locking can't work when running as root, because we have no way of
-        knowing what the user id of the logged in user is (so we don't know
-        whose password to prompt for.)
-       */
-      si->locking_disabled_p = True;
-      si->nolock_reason = "running as root";
-      p = getpwnam ("nobody");
-      if (! p) p = getpwnam ("noaccess");
-      if (! p) p = getpwnam ("daemon");
-      if (! p) p = getpwnam ("bin");
-      if (! p) p = getpwnam ("sys");
-      if (! p)
-       {
-         hack_uid_error = "couldn't find safe uid; running as root.";
-         hack_uid_errno = -1;
-       }
-      else
-       {
-         struct group *g = getgrgid (p->pw_gid);
-         hack_uid_error = hack_uid_buf;
-         sprintf (hack_uid_error, "changing uid/gid to %s/%s (%ld/%ld).",
-                  p->pw_name, (g ? g->gr_name : "???"),
-                  (long) p->pw_uid, (long) p->pw_gid);
-
-         /* Change the gid to be a safe one.  If we can't do that, then
-            print a warning.  We change the gid before the uid so that we
-            change the gid while still root. */
-         if (setgid (p->pw_gid) != 0)
-           {
-             hack_uid_errno = errno;
-             sprintf (hack_uid_error, "couldn't set gid to %s (%ld)",
-                      (g ? g->gr_name : "???"), (long) p->pw_gid);
-           }
-
-         /* Now change the uid to be a safe one. */
-         if (setuid (p->pw_uid) != 0)
-           {
-             hack_uid_errno = errno;
-             sprintf (hack_uid_error, "couldn't set uid to %s (%ld)",
-                      p->pw_name, (long) p->pw_uid);
-           }
-       }
-    }
-# ifndef NO_LOCKING
- else  /* disable locking if already being run as "someone else" */
-   {
-     struct passwd *p = getpwuid (getuid ());
-     if (!p ||
-        !strcmp (p->pw_name, "root") ||
-        !strcmp (p->pw_name, "nobody") ||
-        !strcmp (p->pw_name, "noaccess") ||
-        !strcmp (p->pw_name, "daemon") ||
-        !strcmp (p->pw_name, "bin") ||
-        !strcmp (p->pw_name, "sys"))
-       {
-        si->locking_disabled_p = True;
-        si->nolock_reason = hack_uid_buf;
-        sprintf (si->nolock_reason, "running as %s", p->pw_name);
-       }
-   }
-# endif /* !NO_LOCKING */
-}
-
-void
-hack_uid_warn (saver_info *si)
-{
-  saver_preferences *p = &si->prefs;
-
-  if (! hack_uid_error)
-    ;
-  else if (hack_uid_errno == 0)
-    {
-      if (p->verbose_p)
-       printf ("%s: %s\n", blurb(), hack_uid_error);
-    }
-  else
-    {
-      char buf [255];
-      sprintf (buf, "%s: %s", blurb(), hack_uid_error);
-      if (hack_uid_errno == -1)
-       fprintf (stderr, "%s\n", buf);
-      else
-       {
-         errno = hack_uid_errno;
-         perror (buf);
-       }
-    }
-}
-
-#endif /* !NO_SETUID */
diff --git a/driver/test-passwd.c b/driver/test-passwd.c
new file mode 100644 (file)
index 0000000..019f86d
--- /dev/null
@@ -0,0 +1,289 @@
+/* xscreensaver, Copyright (c) 1998 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+/* This is a kludgy test harness for debugging the password dialog box.
+   It's somewhat easier to debug it here than in the xscreensaver executable
+   itself.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+
+#include "xscreensaver.h"
+#include "resources.h"
+#include "version.h"
+
+char *progname = 0;
+char *progclass = 0;
+XrmDatabase db = 0;
+saver_info *global_si_kludge;
+
+FILE *real_stderr, *real_stdout;
+
+void reset_stderr(saver_screen_info *ssi) {}
+void clear_stderr(saver_screen_info *ssi) {}
+void reset_watchdog_timer(saver_info *si, Bool on_p) {}
+void monitor_power_on (saver_info *si) {}
+void ungrab_keyboard_and_mouse (saver_info *si) {}
+Bool select_visual (saver_screen_info *ssi, const char *v) { return False; }
+void raise_window (saver_info *si, Bool i, Bool b, Bool d) {}
+void restore_real_vroot (saver_info *si) {}
+void saver_exit (saver_info *si, int status, const char *core) { exit(status);}
+const char * signal_name(int signal) { return "???"; }
+Bool monitor_powered_on_p (saver_info *si) { return True; }
+void start_notice_events_timer (saver_info *si, Window w) {}
+void initialize_screensaver_window (saver_info *si) {}
+void blank_screen (saver_info *si) {}
+void unblank_screen (saver_info *si) {}
+Bool handle_clientmessage (saver_info *si, XEvent *e, Bool u) { return False; }
+int BadWindow_ehandler (Display *dpy, XErrorEvent *error) { exit(1); }
+
+const char *blurb(void) { return progname; }
+
+void
+idle_timer (XtPointer closure, XtIntervalId *id)
+{
+  saver_info *si = (saver_info *) closure;
+  XEvent fake_event;
+  fake_event.type = 0; /* XAnyEvent type, ignored. */
+  fake_event.xany.display = si->dpy;
+  fake_event.xany.window  = 0;
+  XPutBackEvent (si->dpy, &fake_event);
+}
+
+
+static char *
+reformat_hack(const char *hack)
+{
+  int i;
+  const char *in = hack;
+  int indent = 13;
+  char *h2 = (char *) malloc(strlen(in) + indent + 2);
+  char *out = h2;
+
+  while (isspace(*in)) in++;           /* skip whitespace */
+  while (*in && !isspace(*in) && *in != ':')
+    *out++ = *in++;                    /* snarf first token */
+  while (isspace(*in)) in++;           /* skip whitespace */
+
+  if (*in == ':')
+    *out++ = *in++;                    /* copy colon */
+  else
+    {
+      in = hack;
+      out = h2;                                /* reset to beginning */
+    }
+
+  *out = 0;
+
+  while (isspace(*in)) in++;           /* skip whitespace */
+  for (i = strlen(h2); i < indent; i++)        /* indent */
+    *out++ = ' ';
+
+  while (*in) *out++ = *in++;          /* copy rest of line */
+  *out = 0;
+
+  return h2;
+}
+
+
+static void
+get_screenhacks (saver_info *si)
+{
+  saver_preferences *p = &si->prefs;
+  int i = 0;
+  int hacks_size = 60;
+  int size;
+  char *d;
+
+  d = get_string_resource ("monoPrograms", "MonoPrograms");
+  if (d && !*d) { free(d); d = 0; }
+  if (!d)
+    d = get_string_resource ("colorPrograms", "ColorPrograms");
+  if (d && !*d) { free(d); d = 0; }
+
+  if (d)
+    {
+      fprintf (stderr,
+       "%s: the `monoPrograms' and `colorPrograms' resources are obsolete;\n\
+       see the manual for details.\n", blurb());
+      free(d);
+    }
+
+  d = get_string_resource ("programs", "Programs");
+
+  size = d ? strlen (d) : 0;
+  p->screenhacks = (char **) malloc (sizeof (char *) * hacks_size);
+  p->screenhacks_count = 0;
+
+  while (i < size)
+    {
+      int end, start = i;
+      if (d[i] == ' ' || d[i] == '\t' || d[i] == '\n' || d[i] == 0)
+       {
+         i++;
+         continue;
+       }
+      if (hacks_size <= p->screenhacks_count)
+       p->screenhacks = (char **) realloc (p->screenhacks,
+                                           (hacks_size = hacks_size * 2) *
+                                           sizeof (char *));
+      p->screenhacks [p->screenhacks_count++] = d + i;
+      while (d[i] != 0 && d[i] != '\n')
+       i++;
+      end = i;
+      while (i > start && (d[i-1] == ' ' || d[i-1] == '\t'))
+       i--;
+      d[i] = 0;
+      i = end + 1;
+    }
+
+  /* shrink all whitespace to one space, for the benefit of the "demo"
+     mode display.  We only do this when we can easily tell that the
+     whitespace is not significant (no shell metachars).
+   */
+  for (i = 0; i < p->screenhacks_count; i++)
+    {
+      char *s = p->screenhacks [i];
+      char *s2;
+      int L = strlen (s);
+      int j, k;
+      for (j = 0; j < L; j++)
+       {
+         switch (s[j])
+           {
+           case '\'': case '"': case '`': case '\\':
+             goto DONE;
+           case '\t':
+             s[j] = ' ';
+           case ' ':
+             k = 0;
+             for (s2 = s+j+1; *s2 == ' ' || *s2 == '\t'; s2++)
+               k++;
+             if (k > 0)
+               {
+                 for (s2 = s+j+1; s2[k]; s2++)
+                   *s2 = s2[k];
+                 *s2 = 0;
+               }
+             break;
+           }
+       }
+    DONE:
+      p->screenhacks[i] = reformat_hack(s);  /* mallocs */
+    }
+
+  if (p->screenhacks_count)
+    {
+      /* Shrink down the screenhacks array to be only as big as it needs to.
+        This doesn't really matter at all. */
+      p->screenhacks = (char **)
+       realloc (p->screenhacks, ((p->screenhacks_count + 1) *
+                                 sizeof(char *)));
+      p->screenhacks [p->screenhacks_count] = 0;
+    }
+  else
+    {
+      free (p->screenhacks);
+      p->screenhacks = 0;
+    }
+}
+
+
+int
+main (int argc, char **argv)
+{
+  Widget toplevel_shell;
+  saver_screen_info ssip;
+  saver_info sip;
+  saver_info *si = &sip;
+  saver_preferences *p = &si->prefs;
+
+  memset(&sip, 0, sizeof(sip));
+  memset(&ssip, 0, sizeof(ssip));
+
+  si->nscreens = 1;
+  si->screens = si->default_screen = &ssip;
+  ssip.global = si;
+
+  global_si_kludge = si;
+  real_stderr = stderr;
+  real_stdout = stdout;
+
+  si->version = (char *) malloc (5);
+  memcpy (si->version, screensaver_id + 17, 4);
+  progname = argv[0];
+
+# ifdef SCO
+  set_auth_parameters(argc, argv);
+# endif /* SCO */
+
+  if (! lock_init (argc, argv))        /* before hack_uid() for proper permissions */
+    {
+      si->locking_disabled_p = True;
+      si->nolock_reason = "error getting password";
+    }
+
+  hack_uid (si);
+
+  progclass = "XScreenSaver";
+
+  toplevel_shell = XtAppInitialize (&si->app, progclass, 0, 0,
+                                   &argc, argv, 0, 0, 0);
+
+  si->dpy = XtDisplay (toplevel_shell);
+  si->db = XtDatabase (si->dpy);
+  si->default_screen->toplevel_shell = toplevel_shell;
+  si->default_screen->screen = XtScreen(toplevel_shell);
+  si->default_screen->default_visual =
+    si->default_screen->current_visual =
+      DefaultVisualOfScreen(si->default_screen->screen);
+  si->default_screen->screensaver_window =
+    RootWindowOfScreen(si->default_screen->screen);
+
+  db = si->db;
+  XtGetApplicationNameAndClass (si->dpy, &progname, &progclass);
+
+  p->debug_p = True;
+  p->verbose_p = True;
+  p->lock_p = True;
+  p->passwd_timeout = 1000 * get_seconds_resource ("passwdTimeout", "Time");
+
+  get_screenhacks(si);
+
+  hack_uid_warn (si);
+
+  while (1)
+    {
+#if 0
+      if (unlock_p (si))
+       fprintf (stderr, "%s: password correct\n", progname);
+      else
+       fprintf (stderr, "%s: password INCORRECT!\n", progname);
+
+      XSync(si->dpy, False);
+      sleep (3);
+#else
+      si->demo_mode_p = True;
+      make_screenhack_dialog (si);
+      XtAppMainLoop(si->app);
+#endif
+    }
+}
diff --git a/driver/test-uid.c b/driver/test-uid.c
new file mode 100644 (file)
index 0000000..d0448f9
--- /dev/null
@@ -0,0 +1,173 @@
+/* uid-test.c --- playing with setuid.
+ * xscreensaver, Copyright (c) 1998 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <pwd.h>
+#include <grp.h>
+
+static void
+print(void)
+{
+  int uid = getuid();
+  int gid = getgid();
+  int euid = geteuid();
+  int egid = getegid();
+  struct passwd *p = 0;
+  struct group *g = 0;
+
+  p = getpwuid (uid);
+  g = getgrgid (gid);
+  fprintf(stderr, "real user/group: %ld/%ld (%s/%s)\n", uid, gid,
+         (p && p->pw_name ? p->pw_name : "???"),
+         (g && g->gr_name ? g->gr_name : "???"));
+
+  p = getpwuid (euid);
+  g = getgrgid (egid);
+  fprintf(stderr, "eff. user/group: %ld/%ld (%s/%s)\n", euid, egid,
+         (p && p->pw_name ? p->pw_name : "???"),
+         (g && g->gr_name ? g->gr_name : "???"));
+}
+
+int
+main (int argc, char **argv)
+{
+  int i;
+  struct passwd *p = 0;
+  struct group *g = 0;
+
+  if (argc <= 1)
+    {
+      fprintf(stderr,
+             "usage: %s [ user/group ... ]\n"
+             "\tEach argument may be a user name, or user/group.\n"
+             "\tThis program will attempt to setuid/setgid to each\n"
+             "\tin turn, and report the results.  The user and group\n"
+             "\tnames may be strings, or numeric.\n",
+             argv[0]);
+      exit(1);
+    }
+
+  print();
+  for (i = 1; i < argc; i++)
+    {
+      char *user = argv[i];
+      char *group = strchr(user, '/');
+      if (group)
+       *group++ = 0;
+
+      if (group && *group)
+       {
+         long gid = 0;
+         int was_numeric = 0;
+
+         g = 0;
+         if (*group == '-' || (*group >= '0' && *group <= '9'))
+           if (1 == sscanf(group, "%ld", &gid))
+             {
+               g = getgrgid (gid);
+               was_numeric = 1;
+             }
+
+         if (!g)
+           g = getgrnam(group);
+
+         if (g)
+           {
+             gid = g->gr_gid;
+             group = g->gr_name;
+           }
+         else
+           {
+             if (was_numeric)
+               {
+                 fprintf(stderr, "no group numbered %s.\n", group);
+                 group = "";
+               }
+             else
+               {
+                 fprintf(stderr, "no group named %s.\n", group);
+                 goto NOGROUP;
+               }
+           }
+
+         fprintf(stderr, "setgid(%ld) \"%s\"", gid, group);
+         if (setgid(gid) == 0)
+           fprintf(stderr, " succeeded.\n");
+         else
+           perror(" failed");
+
+       NOGROUP: ;
+       }
+
+      if (user && *user)
+       {
+         long uid = 0;
+         int was_numeric = 0;
+
+         p = 0;
+         if (*user == '-' || (*user >= '0' && *user <= '9'))
+           if (1 == sscanf(user, "%ld", &uid))
+             {
+               p = getpwuid (uid);
+               was_numeric = 1;
+             }
+
+         if (!p)
+           p = getpwnam(user);
+
+         if (p)
+           {
+             uid = p->pw_uid;
+             user = p->pw_name;
+           }
+         else
+           {
+             if (was_numeric)
+               {
+                 fprintf(stderr, "no user numbered \"%s\".\n", user);
+                 user = "";
+               }
+             else
+               {
+                 fprintf(stderr, "no user named %s.\n", user);
+                 goto NOUSER;
+               }
+           }
+
+         fprintf(stderr, "setuid(%ld) \"%s\"", uid, user);
+         if (setuid(uid) == 0)
+           fprintf(stderr, " succeeded.\n");
+         else
+           perror(" failed");
+       NOUSER: ;
+       }
+      print();
+    }
+
+  fprintf(stderr,
+         "running \"whoami\" and \"groups\" in a sub-process reports:\n");
+  fflush(stdout);
+  fflush(stderr);
+  system ("/bin/sh -c 'echo \"`whoami` / `groups`\"'");
+
+  fflush(stdout);
+  fflush(stderr);
+  exit(0);
+}
index dbab1b387ec1cca5897ff84a8731cbf5becbcf40..77bc8c30fd20b45964ecf2d593324657d6909064 100644 (file)
@@ -1,6 +1,6 @@
 /* timers.c --- detecting when the user is idle, and other timer-related tasks.
  * xscreensaver, Copyright (c) 1991-1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -106,8 +106,8 @@ notice_events (saver_info *si, Window window, Bool top_p)
   if (top_p && p->verbose_p && (events & KeyPressMask))
     {
       /* Only mention one window per tree (hack hack). */
-      printf ("%s: selected KeyPress on 0x%lX\n", blurb(),
-             (unsigned long) window);
+      fprintf (stderr, "%s: selected KeyPress on 0x%lX\n", blurb(),
+              (unsigned long) window);
       top_p = False;
     }
 
@@ -184,13 +184,14 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
   if (si->dbox_up_p || si->question_up_p)
     {
       if (p->verbose_p)
-       printf ("%s: dialog box up; delaying hack change.\n", blurb());
+       fprintf (stderr, "%s: dialog box up; delaying hack change.\n",
+                blurb());
       how_long = 30000; /* 30 secs */
     }
   else
     {
       if (p->verbose_p)
-       printf ("%s: changing graphics hacks.\n", blurb());
+       fprintf (stderr, "%s: changing graphics hacks.\n", blurb());
       kill_screenhack (si);
       spawn_screenhack (si, False);
     }
@@ -199,7 +200,7 @@ cycle_timer (XtPointer closure, XtIntervalId *id)
 
 #ifdef DEBUG_TIMERS
   if (p->verbose_p)
-    printf ("%s: starting cycle_timer (%ld, %ld)\n",
+    fprintf (stderr, "%s: starting cycle_timer (%ld, %ld)\n",
            blurb(), how_long, si->cycle_id);
 #endif /* DEBUG_TIMERS */
 }
@@ -212,7 +213,7 @@ activate_lock_timer (XtPointer closure, XtIntervalId *id)
   saver_preferences *p = &si->prefs;
 
   if (p->verbose_p)
-    printf ("%s: timed out; activating lock\n", blurb());
+    fprintf (stderr, "%s: timed out; activating lock\n", blurb());
   si->locked_p = True;
 
 #ifdef HAVE_XHPDISABLERESET
@@ -236,8 +237,8 @@ reset_timers (saver_info *si)
 
 #ifdef DEBUG_TIMERS
   if (p->verbose_p)
-    printf ("%s:   killing idle_timer    (%ld, %ld)\n",
-           blurb(), p->timeout, si->timer_id);
+    fprintf (stderr, "%s:   killing idle_timer    (%ld, %ld)\n",
+            blurb(), p->timeout, si->timer_id);
 #endif /* DEBUG_TIMERS */
 
   XtRemoveTimeOut (si->timer_id);
@@ -247,8 +248,8 @@ reset_timers (saver_info *si)
 
 #ifdef DEBUG_TIMERS
   if (p->verbose_p)
-    printf ("%s:   restarting idle_timer (%ld, %ld)\n",
-           blurb(), p->timeout, si->timer_id);
+    fprintf (stderr, "%s:   restarting idle_timer (%ld, %ld)\n",
+            blurb(), p->timeout, si->timer_id);
 #endif /* DEBUG_TIMERS */
 
   si->last_activity_time = time ((time_t *) 0);
@@ -298,11 +299,11 @@ check_pointer_timer (XtPointer closure, XtIntervalId *id)
        if (root_x == ssi->poll_mouse_last_root_x &&
            root_y == ssi->poll_mouse_last_root_y &&
            child  == ssi->poll_mouse_last_child)
-         printf ("%s: modifiers changed at %s on screen %d.\n",
-                 blurb(), timestring(), i);
+         fprintf (stderr, "%s: modifiers changed at %s on screen %d.\n",
+                  blurb(), timestring(), i);
        else
-         printf ("%s: pointer moved at %s on screen %d.\n",
-                 blurb(), timestring(), i);
+         fprintf (stderr, "%s: pointer moved at %s on screen %d.\n",
+                  blurb(), timestring(), i);
 #endif /* DEBUG_TIMERS */
 
       si->last_activity_screen    = ssi;
@@ -333,8 +334,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
 
 #ifdef DEBUG_TIMERS
          if (p->verbose_p)
-           printf ("%s: starting idle_timer (%ld, %ld)\n",
-                   blurb(), p->timeout, si->timer_id);
+           fprintf (stderr, "%s: starting idle_timer (%ld, %ld)\n",
+                    blurb(), p->timeout, si->timer_id);
 #endif /* DEBUG_TIMERS */
        }
 
@@ -360,7 +361,7 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
                if (! XGetIdleTime (si->dpy, &idle))
                  {
                    fprintf (stderr, "%s: XGetIdleTime() failed.\n", blurb());
-                   saver_exit (si, 1);
+                   saver_exit (si, 1, 0);
                  }
              }
            else
@@ -398,8 +399,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
                                                idle_timer, (XtPointer) si);
 #ifdef DEBUG_TIMERS
                if (p->verbose_p)
-                 printf ("%s: starting idle_timer (%ld, %ld)\n",
-                         blurb(), p->timeout - idle, si->timer_id);
+                 fprintf (stderr, "%s: starting idle_timer (%ld, %ld)\n",
+                          blurb(), p->timeout - idle, si->timer_id);
 #endif /* DEBUG_TIMERS */
              }
          }
@@ -418,10 +419,11 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
            start_notice_events_timer (si, event.xcreatewindow.window);
 #ifdef DEBUG_TIMERS
            if (p->verbose_p)
-             printf ("%s: starting notice_events_timer for 0x%X (%lu)\n",
-                     blurb(),
-                     (unsigned int) event.xcreatewindow.window,
-                     p->notice_events_timeout);
+             fprintf (stderr,
+                      "%s: starting notice_events_timer for 0x%X (%lu)\n",
+                      blurb(),
+                      (unsigned int) event.xcreatewindow.window,
+                      p->notice_events_timeout);
 #endif /* DEBUG_TIMERS */
          }
        break;
@@ -436,13 +438,20 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
        if (p->verbose_p)
          {
            if (event.xany.type == MotionNotify)
-             printf ("%s: MotionNotify at %s\n", blurb(), timestring ());
+             fprintf (stderr, "%s: MotionNotify at %s\n",
+                      blurb(), timestring ());
            else if (event.xany.type == KeyPress)
-             printf ("%s: KeyPress seen on 0x%X at %s\n", blurb(),
-                     (unsigned int) event.xkey.window, timestring ());
+             fprintf (stderr, "%s: KeyPress seen on 0x%X at %s\n", blurb(),
+                      (unsigned int) event.xkey.window, timestring ());
+           else if (event.xany.type == ButtonPress)
+             fprintf (stderr, "%s: ButtonPress seen on 0x%X at %s\n", blurb(),
+                      (unsigned int) event.xbutton.window, timestring ());
          }
 #endif /* DEBUG_TIMERS */
 
+       /* If any widgets want to handle this event, let them. */
+       XtDispatchEvent (&event);
+
        /* We got a user event */
        if (!until_idle_p)
          goto DONE;
@@ -461,8 +470,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
              {
 # ifdef DEBUG_TIMERS
                if (p->verbose_p)
-                 printf ("%s: ScreenSaverOn event received at %s\n",
-                         blurb(), timestring ());
+                 fprintf (stderr, "%s: ScreenSaverOn event received at %s\n",
+                          blurb(), timestring ());
 # endif /* DEBUG_TIMERS */
 
                /* Get the "real" server window(s) out of the way as soon
@@ -493,16 +502,17 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
              {
 # ifdef DEBUG_TIMERS
                if (p->verbose_p)
-                 printf ("%s: ScreenSaverOff event received at %s\n",
-                         blurb(), timestring ());
+                 fprintf (stderr, "%s: ScreenSaverOff event received at %s\n",
+                          blurb(), timestring ());
 # endif /* DEBUG_TIMERS */
                if (!until_idle_p)
                  goto DONE;
              }
 # ifdef DEBUG_TIMERS
            else if (p->verbose_p)
-             printf ("%s: unknown MIT-SCREEN-SAVER event received at %s\n",
-                     blurb(), timestring ());
+             fprintf (stderr,
+                      "%s: unknown MIT-SCREEN-SAVER event received at %s\n",
+                      blurb(), timestring ());
 # endif /* DEBUG_TIMERS */
          }
        else
@@ -515,8 +525,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
          {
 # ifdef DEBUG_TIMERS
            if (p->verbose_p)
-             printf ("%s: ScreenSaverStart event received at %s\n",
-                     blurb(), timestring ());
+             fprintf (stderr, "%s: ScreenSaverStart event received at %s\n",
+                      blurb(), timestring ());
 # endif /* DEBUG_TIMERS */
 
            if (until_idle_p)
@@ -527,8 +537,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
          {
 # ifdef DEBUG_TIMERS
            if (p->verbose_p)
-             printf ("%s: ScreenSaverEnd event received at %s\n",
-                     blurb(), timestring ());
+             fprintf (stderr, "%s: ScreenSaverEnd event received at %s\n",
+                      blurb(), timestring ());
 # endif /* DEBUG_TIMERS */
            if (!until_idle_p)
              goto DONE;
@@ -603,8 +613,8 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
 
 #ifdef DEBUG_TIMERS
          if (si->prefs.verbose_p)
-           printf ("%s: watchdog timer raising %sscreen.\n",
-                   blurb(), (running_p ? "" : "and clearing "));
+           fprintf (stderr, "%s: watchdog timer raising %sscreen.\n",
+                    blurb(), (running_p ? "" : "and clearing "));
 #endif /* DEBUG_TIMERS */
 
          raise_window (si, True, True, running_p);
@@ -612,8 +622,9 @@ watchdog_timer (XtPointer closure, XtIntervalId *id)
          if (!monitor_powered_on_p (si))
            {
              if (si->prefs.verbose_p)
-               printf ("%s: server reports that monitor has powered down; "
-                       "killing running hacks.\n", blurb());
+               fprintf (stderr,
+                        "%s: server reports that monitor has powered down; "
+                        "killing running hacks.\n", blurb());
              kill_screenhack (si);
            }
        }
@@ -639,8 +650,8 @@ reset_watchdog_timer (saver_info *si, Bool on_p)
 
 #ifdef DEBUG_TIMERS
       if (p->verbose_p)
-       printf ("%s: restarting watchdog_timer (%ld, %ld)\n",
-               blurb(), p->watchdog_timeout, si->watchdog_id);
+       fprintf (stderr, "%s: restarting watchdog_timer (%ld, %ld)\n",
+                blurb(), p->watchdog_timeout, si->watchdog_id);
 #endif /* DEBUG_TIMERS */
 
     }
index a460e6da4937377d9727e951b449c6d4439d60b1..4daa0607ea902bac5e35fd1d2ffa640a10e95e29 100644 (file)
@@ -1,5 +1,5 @@
 /* windows.c --- turning the screen black; dealing with visuals, virtual roots.
- * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -93,8 +93,8 @@ grab_kbd(saver_info *si, Window w)
   if (status == GrabSuccess)
     si->keyboard_grab_window = w;
 
-  if (p->debug_p)
-    fprintf(stderr, "%s: XGrabKeyboard(... 0x%x ...) ==> %s\n",
+  if (p->verbose_p)
+    fprintf(stderr, "%s: grabbing keyboard on 0x%x... %s.\n",
            blurb(), (unsigned long) w,
            (status == GrabSuccess ? "GrabSuccess" :
             status == AlreadyGrabbed ? "AlreadyGrabbed" :
@@ -136,10 +136,9 @@ grab_mouse (saver_info *si, Window w, Cursor cursor)
   if (status == GrabSuccess)
     si->mouse_grab_window = w;
 
-  if (p->debug_p)
-    fprintf(stderr, "%s: XGrabPointer(... 0x%x, 0x%x ...) ==> %s\n",
-           blurb(), (unsigned long) w, (unsigned long) cursor,
-           grab_string(status));
+  if (p->verbose_p)
+    fprintf(stderr, "%s: grabbing mouse on 0x%x... %s.\n",
+           blurb(), (unsigned long) w, grab_string(status));
   return status;
 }
 
@@ -149,8 +148,8 @@ ungrab_kbd(saver_info *si)
 {
   saver_preferences *p = &si->prefs;
   XUngrabKeyboard(si->dpy, CurrentTime);
-  if (p->debug_p)
-    fprintf(stderr, "%s: XUngrabKeyboard (was 0x%x)\n", blurb(),
+  if (p->verbose_p)
+    fprintf(stderr, "%s: ungrabbing keyboard (was 0x%x).\n", blurb(),
            (unsigned long) si->keyboard_grab_window);
   si->keyboard_grab_window = 0;
 }
@@ -161,8 +160,8 @@ ungrab_mouse(saver_info *si)
 {
   saver_preferences *p = &si->prefs;
   XUngrabPointer(si->dpy, CurrentTime);
-  if (p->debug_p)
-    fprintf(stderr, "%s: XUngrabPointer (was 0x%x)\n", blurb(),
+  if (p->verbose_p)
+    fprintf(stderr, "%s: ungrabbing mouse (was 0x%x).\n", blurb(),
            (unsigned long) si->mouse_grab_window);
   si->mouse_grab_window = 0;
 }
@@ -327,8 +326,8 @@ kill_xsetroot_data (Display *dpy, Window window, Bool verbose_p)
          nitems == 1 && bytesafter == 0)
        {
          if (verbose_p)
-           printf ("%s: destroying xsetroot data (0x%lX).\n",
-                   blurb(), *dataP);
+           fprintf (stderr, "%s: destroying xsetroot data (0x%lX).\n",
+                    blurb(), *dataP);
          XKillClient (dpy, *dataP);
        }
       else
@@ -404,8 +403,9 @@ restore_real_vroot_2 (saver_screen_info *ssi)
   saver_info *si = ssi->global;
   saver_preferences *p = &si->prefs;
   if (p->verbose_p && ssi->real_vroot)
-    printf ("%s: restoring __SWM_VROOT property on the real vroot (0x%lx).\n",
-           blurb(), (unsigned long) ssi->real_vroot);
+    fprintf (stderr,
+            "%s: restoring __SWM_VROOT property on the real vroot (0x%lx).\n",
+            blurb(), (unsigned long) ssi->real_vroot);
   remove_vroot_property (si->dpy, ssi->screensaver_window);
   if (ssi->real_vroot)
     {
@@ -546,7 +546,7 @@ catch_signal (saver_info *si, int sig, Bool on_p)
          char buf [255];
          sprintf (buf, "%s: couldn't catch %s", blurb(), signal_name(sig));
          perror (buf);
-         saver_exit (si, 1);
+         saver_exit (si, 1, 0);
        }
     }
 }
@@ -555,8 +555,8 @@ static void
 handle_signals (saver_info *si, Bool on_p)
 {
 #if 0
-  if (on_p) printf ("handling signals\n");
-  else printf ("unhandling signals\n");
+  if (on_p) fprintf (stderr, "handling signals\n");
+  else fprintf (stderr, "unhandling signals\n");
 #endif
 
   catch_signal (si, SIGHUP,  on_p);
@@ -588,7 +588,7 @@ handle_signals (saver_info *si, Bool on_p)
 }
 
 void
-saver_exit (saver_info *si, int status)
+saver_exit (saver_info *si, int status, const char *dump_core_reason)
 {
   saver_preferences *p = &si->prefs;
   static Bool exiting = False;
@@ -614,11 +614,49 @@ saver_exit (saver_info *si, int status)
   else if (status == 1) status = -1;
 #endif
 
-  if (si->prefs.debug_p)
+  if (si->prefs.debug_p && !dump_core_reason)
+    dump_core_reason = "because of -debug";
+
+  if (dump_core_reason)
     {
-      fprintf(real_stderr, "%s: dumping core (because of -debug)\n", blurb());
-      /* Do this to drop a core file, so that we can get a stack trace. */
-      abort();
+#if 0
+      if (si->locking_disabled_p &&
+         si->nolock_reason &&
+         *si->nolock_reason)
+       {
+         /* If locking is disabled, it's because xscreensaver was launched
+            by root, and has relinquished its user id (most likely we are
+            now running as "nobody".)  This means we won't be able to dump
+            core, since "nobody" can't write files; so don't even try.
+          */
+         fprintf(real_stderr, "%s: NOT dumping core (%s)\n", blurb(),
+                 si->nolock_reason);
+       }
+      else
+#endif
+       {
+         /* Note that the Linux man page for setuid() says If uid is
+            different from the old effective uid, the process will be
+            forbidden from leaving core dumps.
+          */
+
+         char cwd[4096]; /* should really be PATH_MAX, but who cares. */
+         fprintf(real_stderr, "%s: dumping core (%s)\n", blurb(),
+                 dump_core_reason);
+
+# if defined(HAVE_GETCWD)
+         getcwd (cwd, sizeof(cwd));
+# elif defined(HAVE_GETWD)
+         getwd (cwd);
+# else
+         strcpy(cwd, "unknown.");
+# endif
+         fprintf (real_stderr, "%s: current directory is %s\n", blurb(), cwd);
+         describe_uids (si, real_stderr);
+
+         /* Do this to drop a core file, so that we can get a stack trace. */
+         abort();
+       }
     }
 
   exit (status);
@@ -897,7 +935,6 @@ raise_window (saver_info *si,
 
   if (p->fade_p && !inhibit_fade && !si->demo_mode_p)
     {
-      int grabbed = -1;
       Window *current_windows = (Window *)
        calloc(sizeof(Window), si->nscreens);
       Colormap *current_maps = (Colormap *)
@@ -916,37 +953,21 @@ raise_window (saver_info *si,
                                ssi->black_pixel);
        }
 
-      if (p->verbose_p) fprintf (stderr, "%s: fading... ", blurb());
+      if (p->verbose_p) fprintf (stderr, "%s: fading...\n", blurb());
 
       XGrabServer (si->dpy);                   /* ############ DANGER! */
 
       /* Clear the stderr layer on each screen.
-        Grab the mouse on the first screen on which the mouse is grabbable
-        (if there are multiple heads, I think you might only be able to
-        grab the mouse on the screen that currently has the mouse?  Anyway,
-        we only grab the mouse once, and don't try again after the grab
-        has succeeded.)  We grab the mouse on the root window of the screen,
-        not on the screensaver window, since the screensaver window is not
-        yet mapped.
        */
-      for (i = 0; i < si->nscreens; i++)
-       {
-         saver_screen_info *ssi = &si->screens[i];
-
-         /* grab and blacken mouse on the root window (saver not mapped yet)
-          */
-         if (grabbed != GrabSuccess)
-           {
-             Window root = RootWindowOfScreen(ssi->screen);
-             grabbed = grab_mouse (si, root,
-                                   (si->demo_mode_p ? 0 : ssi->cursor));
-           }
-
-         if (!dont_clear || ssi->stderr_overlay_window)
-           /* Do this before the fade, since the stderr cmap won't fade
-              even if we uninstall it (beats me...) */
-           clear_stderr (ssi);
-       }
+      if (!dont_clear)
+       for (i = 0; i < si->nscreens; i++)
+         {
+           saver_screen_info *ssi = &si->screens[i];
+           if (ssi->stderr_overlay_window)
+             /* Do this before the fade, since the stderr cmap won't fade
+                even if we uninstall it (beats me...) */
+             clear_stderr (ssi);
+         }
 
       /* Note!  The server is grabbed, and this will take several seconds
         to complete! */
@@ -958,7 +979,7 @@ raise_window (saver_info *si,
       current_maps = 0;
       current_windows = 0;
 
-      if (p->verbose_p) fprintf (stderr, "fading done.\n");
+      if (p->verbose_p) fprintf (stderr, "%s: fading done.\n", blurb());
 
 #ifdef HAVE_MIT_SAVER_EXTENSION
       for (i = 0; i < si->nscreens; i++)
@@ -970,10 +991,6 @@ raise_window (saver_info *si,
        }
 #endif /* HAVE_MIT_SAVER_EXTENSION */
 
-      /* If we had successfully grabbed the mouse, let it go now. */
-      if (grabbed == GrabSuccess)
-       ungrab_mouse (si);
-
       XUngrabServer (si->dpy);
       XSync (si->dpy, False);                  /* ###### (danger over) */
     }
@@ -1007,6 +1024,16 @@ void
 blank_screen (saver_info *si)
 {
   int i;
+
+  /* Note: we do our grabs on the root window, not on the screensaver window.
+     If we grabbed on the saver window, then the demo mode and lock dialog
+     boxes wouldn't get any events.
+   */
+  grab_keyboard_and_mouse (si,
+                          /*si->screens[0].screensaver_window,*/
+                          RootWindowOfScreen(si->screens[0].screen),
+                          (si->demo_mode_p ? 0 : si->screens[0].cursor));
+
   for (i = 0; i < si->nscreens; i++)
     {
       saver_screen_info *ssi = &si->screens[i];
@@ -1019,15 +1046,6 @@ blank_screen (saver_info *si)
   store_activate_time (si, si->screen_blanked_p);
   raise_window (si, False, False, False);
 
-  /* Note: we do our grabs on the root window, not on the screensaver window.
-     If we grabbed on the saver window, then the demo mode and lock dialog
-     boxes wouldn't get any events.
-   */
-  grab_keyboard_and_mouse (si,
-                          /*si->screens[0].screensaver_window,*/
-                          RootWindowOfScreen(si->screens[0].screen),
-                          (si->demo_mode_p ? 0 : si->screens[0].cursor));
-
 #ifdef HAVE_XHPDISABLERESET
   if (si->locked_p && !hp_locked_p)
     {
@@ -1052,7 +1070,6 @@ unblank_screen (saver_info *si)
 
   if (p->unfade_p && !si->demo_mode_p)
     {
-      int grabbed = -1;
       Window *current_windows = (Window *)
        calloc(sizeof(Window), si->nscreens);
 
@@ -1066,7 +1083,7 @@ unblank_screen (saver_info *si)
                                ssi->black_pixel);
        }
 
-      if (p->verbose_p) fprintf (stderr, "%s: unfading... ", blurb());
+      if (p->verbose_p) fprintf (stderr, "%s: unfading...\n", blurb());
 
 
       XSync (si->dpy, False);
@@ -1074,18 +1091,10 @@ unblank_screen (saver_info *si)
       XSync (si->dpy, False);
 
       /* Clear the stderr layer on each screen.
-        Grab the mouse on the first screen on which the mouse is grabbable
-        (if there are multiple heads, I think you might only be able to
-        grab the mouse on the screen that currently has the mouse?  Anyway,
-        we only grab the mouse once, and don't try again after the grab
-        has succeeded.)
        */
       for (i = 0; i < si->nscreens; i++)
        {
          saver_screen_info *ssi = &si->screens[i];
-         if (grabbed != GrabSuccess)
-           grabbed = grab_mouse (si, RootWindowOfScreen (ssi->screen),
-                                 0);
          clear_stderr (ssi);
        }
 
@@ -1100,11 +1109,7 @@ unblank_screen (saver_info *si)
       free(current_windows);
       current_windows = 0;
 
-      if (p->verbose_p) fprintf (stderr, "unfading done.\n");
-
-      /* If we had successfully grabbed the mouse, let it go now. */
-      if (grabbed == GrabSuccess)
-       ungrab_mouse (si);
+      if (p->verbose_p) fprintf (stderr, "%s: unfading done.\n", blurb());
     }
   else
     {
@@ -1256,6 +1261,13 @@ select_visual (saver_screen_info *ssi, const char *visual_name)
       ssi->screensaver_window = 0;
 
       initialize_screensaver_window_1 (ssi);
+
+      /* stderr_overlay_window is a child of screensaver_window, so we need
+        to destroy that as well (actually, we just need to invalidate and
+        drop our pointers to it, but this will destroy it, which is ok so
+        long as it happens before old_w itself is destroyed.) */
+      reset_stderr (ssi);
+
       raise_window (si, True, True, False);
       store_vroot_property (si->dpy,
                            ssi->screensaver_window, ssi->screensaver_window);
index 8ace1506e486b32ef318ec98c9597f65db571915..4c7a02855bd4dbaeb3d0ffdbdf531a9727c98ded 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver-command, Copyright (c) 1991-1998
- *  by Jamie Zawinski <jwz@netscape.com>
+ *  by Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -200,15 +200,15 @@ xscreensaver_command (Display *dpy, Atom command)
 \f
 #ifdef STANDALONE
 static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
-static Atom XA_EXIT, XA_RESTART, XA_DEMO, XA_LOCK;
+static Atom XA_EXIT, XA_RESTART, XA_DEMO, XA_PREFS, XA_LOCK;
 
 static char *progname;
 static char *screensaver_version;
 static char *usage = "\n\
-usage: %s -<switch>\n\
+usage: %s -<option>\n\
 \n\
   This program provides external control of a running xscreensaver process.\n\
-  Version %s, copyright (c) 1991-1997 Jamie Zawinski <jwz@netscape.com>.\n\
+  Version %s, copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>.\n\
 \n\
   The xscreensaver program is a daemon that runs in the background.\n\
   You control a running xscreensaver process by sending it messages\n\
@@ -216,6 +216,9 @@ usage: %s -<switch>\n\
   details.  These are the arguments understood by xscreensaver-command:\n\
 \n\
   -demo         Ask the xscreensaver process to enter interactive demo mode.\n\
+\n\
+  -prefs        Ask the xscreensaver process to bring up the preferences\n\
+                panel.\n\
 \n\
   -activate     Turn on the screensaver (blank the screen), as if the user\n\
                 had been idle for long enough.\n\
@@ -262,7 +265,7 @@ usage: %s -<switch>\n\
                 screen became blanked or un-blanked.)\n\
 \n\
   See the man page for more details.\n\
-  For updates, check http://people.netscape.com/jwz/xscreensaver/\n\
+  For updates, check http://www.jwz.org/xscreensaver/\n\
 \n";
 
 #define USAGE() \
@@ -298,6 +301,8 @@ main (int argc, char **argv)
       else if (!strncmp (s, "-exit", L))       cmd = &XA_EXIT;
       else if (!strncmp (s, "-restart", L))    cmd = &XA_RESTART;
       else if (!strncmp (s, "-demo", L))       cmd = &XA_DEMO;
+      else if (!strncmp (s, "-preferences",L)) cmd = &XA_PREFS;
+      else if (!strncmp (s, "-prefs",L))       cmd = &XA_PREFS;
       else if (!strncmp (s, "-lock", L))       cmd = &XA_LOCK;
       else if (!strncmp (s, "-version", L))    cmd = &XA_SCREENSAVER_VERSION;
       else if (!strncmp (s, "-time", L))       cmd = &XA_SCREENSAVER_TIME;
@@ -327,8 +332,17 @@ main (int argc, char **argv)
   XA_PREV = XInternAtom (dpy, "PREV", False);
   XA_EXIT = XInternAtom (dpy, "EXIT", False);
   XA_DEMO = XInternAtom (dpy, "DEMO", False);
+  XA_PREFS = XInternAtom (dpy, "PREFS", False);
   XA_LOCK = XInternAtom (dpy, "LOCK", False);
 
+  XSync (dpy, 0);
+
+  if (*cmd == XA_ACTIVATE || *cmd == XA_LOCK ||
+      *cmd == XA_NEXT || *cmd == XA_PREV)
+    /* People never guess that KeyRelease deactivates the screen saver too,
+       so if we're issuing an activation command, wait a second. */
+    sleep (1);
+
   xscreensaver_command(dpy, *cmd);
 
   fflush (stdout);
index a542d552bd56f789af1a3153ded2f49290b12b9a..835faa55283123b46a730abc6b5fff737883bdd7 100644 (file)
 .if n .sp 1
 .if t .sp .5
 ..
-.TH XScreenSaver 1 "30-Jun-98 (2.24)" "X Version 11"
+.TH XScreenSaver 1 "02-Oct-98 (2.31)" "X Version 11"
 .SH NAME
 xscreensaver-command - control a running xscreensaver process
 .SH SYNOPSIS
 .B xscreensaver-command
 [\-help] \
 [\-demo] \
+[\-prefs] \
 [\-activate] \
 [\-deactivate] \
 [\-cycle] \
@@ -49,6 +50,13 @@ can experiment with the various graphics hacks available.  See
 .BR xscreensaver (1)
 for details.
 .TP 8
+.B \-prefs
+Cause the screensaver to enter its interactive demo mode, and bring up
+the Preferences control panel, in which one can change most of the settings
+that control the xscreensaver daemon's behavior.  See
+.BR xscreensaver (1)
+for details.
+.TP 8
 .B \-activate
 Tell xscreensaver to turn on immediately (that is, blank the screen, as if
 the user had been idle for long enough.)  The screensaver will deactivate as
@@ -138,7 +146,7 @@ the \fIxscreensaver\fP process, not the \fIxscreensaver-command\fP process.
 The latest version of
 .BR xscreensaver (1)
 and \fIxscreensaver\-command\fP can always be found at 
-http://people.netscape.com/jwz/xscreensaver/
+http://www.jwz.org/xscreensaver/
 .SH "SEE ALSO"
 .BR X (1),
 .BR xscreensaver (1)
@@ -156,6 +164,6 @@ documentation.  No representations are made about the suitability of this
 software for any purpose.  It is provided "as is" without express or implied
 warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
 
 Please let me know if you find any bugs or make any improvements.
index accfbdf596f7c9b0053a520a405ed3ace8495322..8942df98c5198ad6708bcf5bf577508147e87cfe 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -159,7 +159,8 @@ XrmDatabase db = 0;
 
 
 static Atom XA_ACTIVATE, XA_DEACTIVATE, XA_CYCLE, XA_NEXT, XA_PREV;
-static Atom XA_EXIT, XA_RESTART, XA_DEMO, XA_LOCK;
+static Atom XA_EXIT, XA_RESTART, XA_LOCK;
+Atom XA_DEMO, XA_PREFS;
 
 \f
 static XrmOptionDescRec options [] = {
@@ -173,14 +174,21 @@ static XrmOptionDescRec options [] = {
   { "-no-install",        ".installColormap",  XrmoptionNoArg, "off" },
   { "-verbose",                   ".verbose",          XrmoptionNoArg, "on" },
   { "-silent",            ".verbose",          XrmoptionNoArg, "off" },
+  { "-timestamp",         ".timestamp",        XrmoptionNoArg, "on" },
   { "-xidle-extension",           ".xidleExtension",   XrmoptionNoArg, "on" },
   { "-no-xidle-extension", ".xidleExtension",  XrmoptionNoArg, "off" },
   { "-mit-extension",     ".mitSaverExtension",XrmoptionNoArg, "on" },
   { "-no-mit-extension",   ".mitSaverExtension",XrmoptionNoArg, "off" },
   { "-sgi-extension",     ".sgiSaverExtension",XrmoptionNoArg, "on" },
   { "-no-sgi-extension",   ".sgiSaverExtension",XrmoptionNoArg, "off" },
+  { "-splash",            ".splash",           XrmoptionNoArg, "on" },
+  { "-no-splash",         ".splash",           XrmoptionNoArg, "off" },
+  { "-nosplash",          ".splash",           XrmoptionNoArg, "off" },
   { "-idelay",            ".initialDelay",     XrmoptionSepArg, 0 },
-  { "-nice",              ".nice",             XrmoptionSepArg, 0 }
+  { "-nice",              ".nice",             XrmoptionSepArg, 0 },
+
+  /* Actually this one is built in to Xt, but just to be sure... */
+  { "-synchronous",       ".synchronous",      XrmoptionNoArg, "on" }
 };
 
 static char *defaults[] = {
@@ -188,30 +196,30 @@ static char *defaults[] = {
  0
 };
 
+#ifdef _VROOT_H_
+ERROR!  You must not include vroot.h in this file.
+#endif
+
 static void
 do_help (saver_info *si)
 {
-  printf ("\
-xscreensaver %s, copyright (c) 1991-1998 by Jamie Zawinski <jwz@netscape.com>\n\
+  fflush (stdout);
+  fflush (stderr);
+  fprintf (stdout, "\
+xscreensaver %s, copyright (c) 1991-1998 by Jamie Zawinski <jwz@jwz.org>\n\
 The standard Xt command-line options are accepted; other options include:\n\
 \n\
-    -timeout <minutes>         When the screensaver should activate.\n\
-    -cycle <minutes>           How long to let each hack run.\n\
-    -lock-mode                 Require a password before deactivating.\n\
-    -no-lock-mode              Don't.\n\
-    -lock-timeout <minutes>    Grace period before locking; default 0.\n\
-    -visual <id-or-class>      Which X visual to run on.\n\
-    -install                   Install a private colormap.\n\
-    -no-install                Don't.\n\
-    -verbose                   Be loud.\n\
-    -silent                    Don't.\n\
-    -mit-extension             Use the R6 MIT_SCREEN_SAVER server extension.\n\
-    -no-mit-extension          Don't.\n\
-    -sgi-extension             Use the SGI SCREEN-SAVER server extension.\n\
-    -no-sgi-extension          Don't.\n\
-    -xidle-extension           Use the R5 XIdle server extension.\n\
-    -no-xidle-extension        Don't.\n\
-    -help                      This message.\n\
+    -timeout <minutes>       When the screensaver should activate.\n\
+    -cycle <minutes>         How long to let each hack run before switching.\n\
+    -lock-mode               Require a password before deactivating.\n\
+    -lock-timeout <minutes>  Grace period before locking; default 0.\n\
+    -visual <id-or-class>    Which X visual to run on.\n\
+    -install                 Install a private colormap.\n\
+    -verbose                 Be loud.\n\
+    -no-splash               Don't display a splash-screen at startup.\n\
+    -help                    This message.\n\
+\n\
+See the manual for other options and X resources.\n\
 \n\
 The `xscreensaver' program should be left running in the background.\n\
 Use the `xscreensaver-command' program to manipulate a running xscreensaver.\n\
@@ -219,21 +227,16 @@ Use the `xscreensaver-command' program to manipulate a running xscreensaver.\n\
 The `*programs' resource controls which graphics demos will be launched by\n\
 the screensaver.  See `man xscreensaver' or the web page for more details.\n\
 \n\
-For updates, check http://people.netscape.com/jwz/xscreensaver/\n\n",
+Just getting started?  Try this:\n\
+\n\
+        xscreensaver &\n\
+        xscreensaver-command -demo\n\
+\n\
+For updates, check http://www.jwz.org/xscreensaver/\n\
+\n",
          si->version);
-
-#ifdef NO_LOCKING
-  printf ("Support for locking was not enabled at compile-time.\n");
-#endif
-#ifdef NO_DEMO_MODE
-  printf ("Support for demo mode was not enabled at compile-time.\n");
-#endif
-#if !defined(HAVE_XIDLE_EXTENSION) && !defined(HAVE_MIT_SAVER_EXTENSION) && !defined(HAVE_SGI_SAVER_EXTENSION)
-  printf ("Support for the XIDLE, SCREEN_SAVER, and MIT-SCREEN-SAVER server\
- extensions\nwas not enabled at compile-time.\n");
-#endif /* !HAVE_XIDLE_EXTENSION && !HAVE_MIT_SAVER_EXTENSION && !HAVE_SGI_SAVER_EXTENSION */
-
   fflush (stdout);
+  fflush (stderr);
   exit (1);
 }
 
@@ -385,6 +388,10 @@ get_resources (saver_info *si)
   char *s;
   saver_preferences *p = &si->prefs;
 
+  p->xsync_p       = get_boolean_resource ("synchronous", "Synchronous");
+  if (p->xsync_p)
+    XSynchronize(si->dpy, True);
+
   p->verbose_p     = get_boolean_resource ("verbose", "Boolean");
   p->timestamp_p    = get_boolean_resource ("timestamp", "Boolean");
   p->lock_p        = get_boolean_resource ("lock", "Boolean");
@@ -395,10 +402,11 @@ get_resources (saver_info *si)
   p->install_cmap_p = get_boolean_resource ("installColormap", "Boolean");
   p->nice_inferior  = get_integer_resource ("nice", "Nice");
 
-  p->initial_delay  = get_seconds_resource ("initialDelay", "Time");
-  p->timeout        = 1000 * get_minutes_resource ("timeout", "Time");
-  p->lock_timeout   = 1000 * get_minutes_resource ("lockTimeout", "Time");
-  p->cycle          = 1000 * get_minutes_resource ("cycle", "Time");
+  p->initial_delay   = get_seconds_resource ("initialDelay", "Time");
+  p->splash_duration = 1000 * get_seconds_resource ("splashDuration", "Time");
+  p->timeout         = 1000 * get_minutes_resource ("timeout", "Time");
+  p->lock_timeout    = 1000 * get_minutes_resource ("lockTimeout", "Time");
+  p->cycle           = 1000 * get_minutes_resource ("cycle", "Time");
 
 #ifndef NO_LOCKING
   p->passwd_timeout = 1000 * get_seconds_resource ("passwdTimeout", "Time");
@@ -409,6 +417,13 @@ get_resources (saver_info *si)
                                                       "Time");
   p->shell = get_string_resource ("bourneShell", "BourneShell");
 
+  p->help_url = get_string_resource("helpURL", "URL");
+  p->load_url_command = get_string_resource("loadURL", "LoadURL");
+
+  if ((s = get_string_resource ("splash", "Boolean")))
+    if (!get_boolean_resource("splash", "Boolean"))
+      p->splash_duration = 0;
+  if (s) free (s);
 
   /* don't set use_xidle_extension unless it is explicitly specified */
   if ((s = get_string_resource ("xidleExtension", "Boolean")))
@@ -468,26 +483,14 @@ get_resources (saver_info *si)
 #ifdef NO_LOCKING
   si->locking_disabled_p = True;
   si->nolock_reason = "not compiled with locking support";
-  if (p->lock_p)
-    {
-      p->lock_p = False;
-      fprintf (stderr, "%s: not compiled with support for locking.\n",
-              blurb());
-    }
-#else  /* ! NO_LOCKING */
-  if (p->lock_p && si->locking_disabled_p)
-    {
-      fprintf (stderr, "%s: locking is disabled (%s).\n", blurb(),
-              si->nolock_reason);
-      p->lock_p = False;
-    }
-#endif /* ! NO_LOCKING */
+#endif /* NO_LOCKING */
 
   get_screenhacks (si);
 
   if (p->debug_p)
     {
       XSynchronize(si->dpy, True);
+      p->xsync_p = True;
       p->verbose_p = True;
       p->timestamp_p = True;
       p->initial_delay = 0;
@@ -517,6 +520,8 @@ main (int argc, char **argv)
   memset(&si, 0, sizeof(si));
   global_si_kludge = &si;      /* I hate C so much... */
   initialize (&si, argc, argv);
+  if (!si.demo_mode_p)
+    pop_splash_dialog (&si);
   main_loop (&si);             /* doesn't return */
   return 0;
 }
@@ -527,9 +532,28 @@ saver_ehandler (Display *dpy, XErrorEvent *error)
 {
   saver_info *si = global_si_kludge;   /* I hate C so much... */
 
-  fprintf (real_stderr, "\nX error in %s:\n", blurb());
+  fprintf (real_stderr, "\n"
+          "#######################################"
+          "#######################################\n\n"
+          "%s: X Error!  PLEASE REPORT THIS BUG.\n\n"
+          "#######################################"
+          "#######################################\n\n",
+          blurb());
   if (XmuPrintDefaultErrorMessage (dpy, error, real_stderr))
-    saver_exit (si, -1);
+    {
+      fprintf (real_stderr, "\n");
+      if (si->prefs.xsync_p)
+       {
+         saver_exit (si, -1, "because of synchronous X Error");
+       }
+      else
+       {
+         fprintf(real_stderr,
+                 "%s: to dump a core file, re-run with `-sync'.\n\n",
+                 blurb());
+         saver_exit (si, -1, 0);
+       }
+    }
   else
     fprintf (real_stderr, " (nonfatal.)\n");
   return 0;
@@ -544,8 +568,7 @@ blurb (void)
   else
     {
       static char buf[255];
-      time_t now = time ((time_t *) 0);
-      char *ct = (char *) ctime (&now);
+      char *ct = timestring();
       int n = strlen(progname);
       if (n > 100) n = 99;
       strncpy(buf, progname, n);
@@ -562,6 +585,7 @@ initialize_connection (saver_info *si, int argc, char **argv)
 {
   int i;
   Widget toplevel_shell;
+  saver_preferences *p = &si->prefs;
 
   /* The X resource database blows up if argv[0] has a "." in it. */
   {
@@ -582,7 +606,10 @@ initialize_connection (saver_info *si, int argc, char **argv)
 
   db = si->db; /* resources.c needs this */
 
-  if (argc == 2 && !strcmp (argv[1], "-help"))
+  if (argc == 2 &&
+      (!strcmp (argv[1], "-h") ||
+       !strcmp (argv[1], "-help") ||
+       !strcmp (argv[1], "--help")))
     do_help (si);
 
   else if (argc == 2 && !strcmp (argv[1], "-debug"))
@@ -603,6 +630,8 @@ initialize_connection (saver_info *si, int argc, char **argv)
          !strcmp (s, "-exit") ||
          !strcmp (s, "-restart") ||
          !strcmp (s, "-demo") ||
+         !strcmp (s, "-prefs") ||
+         !strcmp (s, "-preferences") ||
          !strcmp (s, "-lock") ||
          !strcmp (s, "-version") ||
          !strcmp (s, "-time"))
@@ -612,7 +641,7 @@ initialize_connection (saver_info *si, int argc, char **argv)
     The `xscreensaver' program is a daemon that runs in the background.\n\
     You control a running xscreensaver process by sending it messages\n\
     with `xscreensaver-command'.  See the man pages for details,\n\
-    or check the web page: http://people.netscape.com/jwz/xscreensaver/\n\n",
+    or check the web page: http://www.jwz.org/xscreensaver/\n\n",
                   s);
 
          /* Since version 1.21 renamed the "-lock" option to "-lock-mode",
@@ -626,9 +655,28 @@ initialize_connection (saver_info *si, int argc, char **argv)
       exit (1);
     }
   get_resources (si);
-#ifndef NO_SETUID
-  hack_uid_warn (si);
-#endif /* NO_SETUID */
+
+  if (p->lock_p && si->locking_disabled_p)
+    {
+      p->lock_p = False;
+      fprintf (stderr, "%s: locking is disabled (%s).\n", blurb(),
+              si->nolock_reason);
+      if (strstr (si->nolock_reason, "passw"))
+       fprintf (stderr, "%s: does xscreensaver need to be setuid?  "
+                "consult the manual.\n", blurb());
+    }
+
+  /* Defer the printing of this message until after we have loaded the
+     resources and know whether `verbose' is on.
+   */
+  if (p->verbose_p && si->uid_message)
+    {
+      if (si->orig_uid && *si->orig_uid)
+       fprintf (stderr, "%s: initial effective uid/gid was %s.\n", blurb(),
+                si->orig_uid);
+      fprintf (stderr, "%s: %s\n", blurb(), si->uid_message);
+    }
+
   XA_VROOT = XInternAtom (si->dpy, "__SWM_VROOT", False);
   XA_SCREENSAVER = XInternAtom (si->dpy, "SCREENSAVER", False);
   XA_SCREENSAVER_VERSION = XInternAtom (si->dpy, "_SCREENSAVER_VERSION",False);
@@ -643,6 +691,7 @@ initialize_connection (saver_info *si, int argc, char **argv)
   XA_PREV = XInternAtom (si->dpy, "PREV", False);
   XA_EXIT = XInternAtom (si->dpy, "EXIT", False);
   XA_DEMO = XInternAtom (si->dpy, "DEMO", False);
+  XA_PREFS = XInternAtom (si->dpy, "PREFS", False);
   XA_LOCK = XInternAtom (si->dpy, "LOCK", False);
 
   si->nscreens = ScreenCount(si->dpy);
@@ -733,8 +782,8 @@ initialize (saver_info *si, int argc, char **argv)
   initialize_connection (si, argc, argv);
 
   if (p->verbose_p)
-    printf ("\
-%s %s, copyright (c) 1991-1998 by Jamie Zawinski <jwz@netscape.com>\n\
+    fprintf (stderr, "\
+%s %s, copyright (c) 1991-1998 by Jamie Zawinski <jwz@jwz.org>\n\
  pid = %d.\n", progname, si->version, (int) getpid ());
 
   
@@ -747,6 +796,20 @@ initialize (saver_info *si, int argc, char **argv)
   si->demo_mode_p = initial_demo_mode_p;
   srandom ((int) time ((time_t *) 0));
 
+  if (p->debug_p)
+    fprintf (stderr, "\n"
+            "%s: Warning: running in DEBUG MODE.  Be afraid.\n"
+            "\n"
+            "\tNote that in debug mode, the xscreensaver window will only\n"
+            "\tcover the left half of the screen.  (The idea is that you\n"
+            "\tcan still see debugging output in a shell, if you position\n"
+            "\tit on the right side of the screen.)\n"
+            "\n"
+            "\tDebug mode is NOT SECURE.  Do not run with -debug in\n"
+            "\tuntrusted environments.\n"
+            "\n",
+            progname);
+
   if (p->use_sgi_saver_extension)
     {
 #ifdef HAVE_SGI_SAVER_EXTENSION
@@ -854,18 +917,21 @@ initialize (saver_info *si, int argc, char **argv)
        {
          if (p->verbose_p)
            {
-             printf ("%s: waiting for %d second%s...", blurb(),
-                     (int) p->initial_delay,
-                     (p->initial_delay == 1 ? "" : "s"));
+             fprintf (stderr, "%s: waiting for %d second%s...", blurb(),
+                      (int) p->initial_delay,
+                      (p->initial_delay == 1 ? "" : "s"));
+             fflush (stderr);
              fflush (stdout);
            }
          sleep (p->initial_delay);
          if (p->verbose_p)
-           printf (" done.\n");
+           fprintf (stderr, " done.\n");
        }
       if (p->verbose_p)
        {
-         printf ("%s: selecting events on extant windows...", blurb());
+         fprintf (stderr, "%s: selecting events on extant windows...",
+                  blurb());
+         fflush (stderr);
          fflush (stdout);
        }
 
@@ -877,7 +943,7 @@ initialize (saver_info *si, int argc, char **argv)
                                   RootWindowOfScreen (si->screens[i].screen));
 
       if (p->verbose_p)
-       printf (" done.\n");
+       fprintf (stderr, " done.\n");
     }
 }
 
@@ -897,8 +963,8 @@ main_loop (saver_info *si)
 #endif /* !NO_DEMO_MODE */
        {
          if (p->verbose_p)
-           printf ("%s: user is idle; waking up at %s.\n", blurb(),
-                   timestring());
+           fprintf (stderr, "%s: user is idle; waking up at %s.\n", blurb(),
+                    timestring());
          blank_screen (si);
          spawn_screenhack (si, True);
          if (p->cycle)
@@ -926,37 +992,18 @@ main_loop (saver_info *si)
              if (si->locking_disabled_p) abort ();
              si->dbox_up_p = True;
 
-             /* We used to ungrab the keyboard here, before calling unlock_p()
-                to pop up the dialog box.  This left the keyboard ungrabbed
-                for a small window, during an insecure state.  Bennett Todd
-                was seeing the bahavior that, when the load was high, he could
-                actually get characters through to a shell under the saver
-                window (he accidentally typed his password there...)
-
-                So the ungrab has been moved down into pop_passwd_dialog()
-                just after the server is grabbed, closing this window
-                entirely.
-              */
-             /* ungrab_keyboard_and_mouse (si); */
-
              {
                saver_screen_info *ssi = si->default_screen;
                suspend_screenhack (si, True);
                XUndefineCursor (si->dpy, ssi->screensaver_window);
                if (p->verbose_p)
-                 printf ("%s: prompting for password.\n", blurb());
+                 fprintf (stderr, "%s: prompting for password.\n", blurb());
                val = unlock_p (si);
                if (p->verbose_p && val == False)
-                 printf ("%s: password incorrect!\n", blurb());
+                 fprintf (stderr, "%s: password incorrect!\n", blurb());
                si->dbox_up_p = False;
                XDefineCursor (si->dpy, ssi->screensaver_window, ssi->cursor);
                suspend_screenhack (si, False);
-
-               /* I think this grab is now redundant, but it shouldn't hurt.
-                */
-               if (!si->demo_mode_p)
-                 grab_keyboard_and_mouse (si, ssi->screensaver_window,
-                                          ssi->cursor);
              }
 
              if (! val)
@@ -965,6 +1012,10 @@ main_loop (saver_info *si)
            }
 #endif /* !NO_LOCKING */
 
+         if (p->verbose_p)
+           fprintf (stderr, "%s: user is active at %s.\n",
+                    blurb(), timestring ());
+
          /* Let's kill it before unblanking, to get it to stop drawing as
             soon as possible... */
          kill_screenhack (si);
@@ -985,8 +1036,7 @@ main_loop (saver_info *si)
 #endif /* !NO_LOCKING */
 
          if (p->verbose_p)
-           printf ("%s: user is active; going to sleep at %s.\n", blurb(),
-                   timestring ());
+           fprintf (stderr, "%s: going to sleep.\n", blurb());
        }
     }
 }
@@ -1020,7 +1070,8 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (until_idle_p)
        {
          if (p->verbose_p)
-           printf ("%s: ACTIVATE ClientMessage received.\n", blurb());
+           fprintf (stderr,
+                    "%s: ACTIVATE ClientMessage received.\n", blurb());
          if (p->use_mit_saver_extension || p->use_sgi_saver_extension)
            {
              XForceScreenSaver (si->dpy, ScreenSaverActive);
@@ -1040,7 +1091,8 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (! until_idle_p)
        {
          if (p->verbose_p)
-           printf ("%s: DEACTIVATE ClientMessage received.\n", blurb());
+           fprintf (stderr, "%s: DEACTIVATE ClientMessage received.\n",
+                    blurb());
          if (p->use_mit_saver_extension || p->use_sgi_saver_extension)
            {
              XForceScreenSaver (si->dpy, ScreenSaverReset);
@@ -1060,7 +1112,7 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (! until_idle_p)
        {
          if (p->verbose_p)
-           printf ("%s: CYCLE ClientMessage received.\n", blurb());
+           fprintf (stderr, "%s: CYCLE ClientMessage received.\n", blurb());
          if (si->cycle_id)
            XtRemoveTimeOut (si->cycle_id);
          si->cycle_id = 0;
@@ -1073,7 +1125,7 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
   else if (type == XA_NEXT || type == XA_PREV)
     {
       if (p->verbose_p)
-       printf ("%s: %s ClientMessage received.\n", blurb(),
+       fprintf (stderr, "%s: %s ClientMessage received.\n", blurb(),
                (type == XA_NEXT ? "NEXT" : "PREV"));
       si->next_mode_p = 1 + (type == XA_PREV);
 
@@ -1093,14 +1145,14 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (until_idle_p || !si->locked_p)
        {
          if (p->verbose_p)
-           printf ("%s: EXIT ClientMessage received.\n", blurb());
+           fprintf (stderr, "%s: EXIT ClientMessage received.\n", blurb());
          if (! until_idle_p)
            {
              unblank_screen (si);
              kill_screenhack (si);
              XSync (si->dpy, False);
            }
-         saver_exit (si, 0);
+         saver_exit (si, 0, 0);
        }
       else
        fprintf (stderr, "%s: EXIT ClientMessage received while locked.\n",
@@ -1114,7 +1166,7 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (until_idle_p || !si->locked_p)
        {
          if (p->verbose_p)
-           printf ("%s: RESTART ClientMessage received.\n", blurb());
+           fprintf (stderr, "%s: RESTART ClientMessage received.\n", blurb());
          if (! until_idle_p)
            {
              unblank_screen (si);
@@ -1143,12 +1195,29 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
       if (until_idle_p)
        {
          if (p->verbose_p)
-           printf ("%s: DEMO ClientMessage received.\n", blurb());
+           fprintf (stderr, "%s: DEMO ClientMessage received.\n", blurb());
          si->demo_mode_p = True;
          return True;
        }
       fprintf (stderr,
               "%s: DEMO ClientMessage received while active.\n", blurb());
+#endif
+    }
+  else if (type == XA_PREFS)
+    {
+#ifdef NO_DEMO_MODE
+      fprintf (stderr, "%s: not compiled with support for DEMO mode\n",
+              blurb());
+#else
+      if (until_idle_p)
+       {
+         if (p->verbose_p)
+           fprintf (stderr, "%s: PREFS ClientMessage received.\n", blurb());
+         si->demo_mode_p = (Bool) 2;  /* kludge, so sue me. */
+         return True;
+       }
+      fprintf (stderr,
+              "%s: PREFS ClientMessage received while active.\n", blurb());
 #endif
     }
   else if (type == XA_LOCK)
@@ -1169,7 +1238,7 @@ handle_clientmessage (saver_info *si, XEvent *event, Bool until_idle_p)
        {
          si->locked_p = True;
          if (p->verbose_p) 
-           printf ("%s: LOCK ClientMessage received;%s locking.\n",
+           fprintf (stderr, "%s: LOCK ClientMessage received;%s locking.\n",
                    blurb(), until_idle_p ? " activating and" : "");
 
          if (si->lock_id)      /* we're doing it now, so lose the timeout */
index db2f87841352ebb914628f8760c945a81a8cddd0..be5d24f755bd7297ebd6719b660e2f8616b0485a 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -40,6 +40,7 @@ struct saver_preferences {
   Bool verbose_p;              /* whether to print out lots of status info */
   Bool timestamp_p;            /* whether to mark messages with a timestamp */
   Bool debug_p;                        /* pay no mind to the man behind the curtain */
+  Bool xsync_p;                        /* whether XSynchronize has been called */
 
   Bool lock_p;                 /* whether to lock as well as save */
   Bool fade_p;                 /* whether to fade to black */
@@ -56,6 +57,7 @@ struct saver_preferences {
   int nice_inferior;           /* nice value for subprocs */
 
   int initial_delay;           /* how long to sleep after launch */
+  Time splash_duration;                /* how long the splash screen stays up */
   Time timeout;                        /* how much idle time before activation */
   Time lock_timeout;           /* how long after activation locking starts */
   Time cycle;                  /* how long each hack should run */
@@ -72,6 +74,8 @@ struct saver_preferences {
 
   char *shell;                 /* where to find /bin/sh */
 
+  char *help_url;              /* Where the help document resides. */
+  char *load_url_command;      /* How one loads URLs. */
 };
 
 
@@ -118,15 +122,22 @@ struct saver_info {
 
 
   /* =======================================================================
-     locking
+     locking and runtime priveleges
      ======================================================================= */
 
-  Bool locking_disabled_p;     /* Sometimes locking is impossible. */
-  char *nolock_reason;         /* This is why. */
   Bool locked_p;               /* Whether the screen is currently locked. */
   Bool dbox_up_p;              /* Whether the demo-mode or passwd dialogs
                                   are currently visible */
 
+  Bool locking_disabled_p;     /* Sometimes locking is impossible. */
+  char *nolock_reason;         /* This is why. */
+
+  char *orig_uid;              /* What uid/gid we had at startup, before
+                                  discarding priveleges. */
+  char *uid_message;           /* Any diagnostics from our attempt to
+                                  discard priveleges (printed only in
+                                  -verbose mode.) */
+
   /* =======================================================================
      demoing
      ======================================================================= */
@@ -143,7 +154,7 @@ struct saver_info {
   Bool question_up_p;          /* Whether the question dialog is currently
                                   visible. */
   Widget question_dialog;      /* The question dialog, if any. */
-
+  Widget splash_dialog;                /* The splash screen window, if any. */
 
   /* =======================================================================
      timers
@@ -292,11 +303,18 @@ extern void ungrab_keyboard_and_mouse (saver_info *si);
 
 #ifndef NO_LOCKING
 extern Bool unlock_p (saver_info *si);
-extern create_passwd_dialog (Widget, Visual *, Colormap);
+extern void create_passwd_dialog (Widget, Visual *, Colormap);
 extern Bool lock_init (int argc, char **argv);
 extern Bool passwd_valid_p (const char *typed_passwd);
 #endif
 
+/* =======================================================================
+   runtime priveleges
+   ======================================================================= */
+
+extern void hack_uid (saver_info *si);
+extern void describe_uids (saver_info *si, FILE *out);
+
 /* =======================================================================
    demoing
    ======================================================================= */
@@ -304,8 +322,8 @@ extern Bool passwd_valid_p (const char *typed_passwd);
 #ifndef NO_DEMO_MODE
 extern void demo_mode (saver_info *si);
 extern void demo_mode_restart_process (saver_info *si);
-extern create_demo_dialog (Widget, Visual *, Colormap);
-extern create_resources_dialog (Widget, Visual *, Colormap);
+extern void create_demo_dialog (Widget, Visual *, Colormap);
+extern void create_resources_dialog (Widget, Visual *, Colormap);
 #endif
 
 #if !defined(NO_LOCKING) || !defined(NO_DEMO_MODE)
@@ -314,9 +332,9 @@ extern void format_into_label (Widget label, const char *arg);
 extern void steal_focus_and_colormap (Widget dialog);
 #endif
 
-#ifdef HAVE_MOTIF
-extern void disable_motif_drag_and_drop(Widget w);
-#endif
+extern void create_splash_dialog (Widget, Visual *, Colormap);
+extern void pop_splash_dialog (saver_info *si);
+extern void roger (Widget button, XtPointer client_data, XtPointer call_data);
 
 
 /* =======================================================================
@@ -350,18 +368,6 @@ extern void emergency_kill_subproc (saver_info *si);
 extern Bool select_visual (saver_screen_info *ssi, const char *visual_name);
 extern const char *signal_name (int signal);
 
-/* =======================================================================
-   subprocs security
-   ======================================================================= */
-
-#ifdef NO_SETUID
-# define hack_uid()
-# define hack_uid_warn()
-#else /* !NO_SETUID */
- extern void hack_uid (saver_info *si);
- extern void hack_uid_warn (saver_info *si);
-#endif /* NO_SETUID */
-
 /* =======================================================================
    subprocs diagnostics
    ======================================================================= */
@@ -378,7 +384,7 @@ extern void clear_stderr (saver_screen_info *ssi);
 
 extern const char *blurb (void);
 extern void save_argv (int argc, char **argv);
-extern void saver_exit (saver_info *si, int status);
+extern void saver_exit (saver_info *si, int status, const char *core_reason);
 extern void restart_process (saver_info *si);
 
 extern int saver_ehandler (Display *dpy, XErrorEvent *error);
@@ -389,5 +395,6 @@ extern char *timestring (void);
 extern Atom XA_VROOT, XA_XSETROOT_ID;
 extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID;
 extern Atom XA_SCREENSAVER_TIME;
+extern Atom XA_DEMO, XA_PREFS;
 
 #endif /* __XSCREENSAVER_H__ */
index 3db467c4726038606295c727a3d83a45d62637f1..a93461e707098a3e667afd9283cc371683a2b1bf 100644 (file)
@@ -11,7 +11,7 @@
 .if n .sp 1
 .if t .sp .5
 ..
-.TH XScreenSaver 1 "30-Jun-98 (2.24)" "X Version 11"
+.TH XScreenSaver 1 "02-Oct-98 (2.31)" "X Version 11"
 .SH NAME
 xscreensaver - graphics hack and screen locker, launched when the user is idle
 .SH SYNOPSIS
@@ -27,6 +27,9 @@ xscreensaver - graphics hack and screen locker, launched when the user is idle
 [\-no\-install] \
 [\-verbose] \
 [\-silent] \
+[\-timestamp] \
+[\-splash] \
+[\-no\-splash] \
 [\-nice \fIint\fP] \
 [\-mit\-extension] \
 [\-no\-mit\-extension] \
@@ -242,10 +245,29 @@ the \fBdefault\-n\fP name in the section about the \fBprograms\fP resource.
 .B verbose\fP (class \fBBoolean\fP)
 Whether to print diagnostics.  Default false.
 .TP 8
+.B timestamp\fP (class \fBBoolean\fP)
+Whether to print the time of day along with any other diagnostic messages.
+Default false.
+.TP 8
+.B splash\fP (class \fBBoolean\fP)
+Whether to display a splash screen at startup.  Default true.
+.TP 8
+.B splashDuration\fP (class \fBTime\fP)
+How long the splash screen should remain visible; default 5 seconds.
+.TP 8
+.B helpURL\fP (class \fBURL\fP)
+The splash screen has a \fIHelp\fP button on it.  When you press it, it will
+display the web page indicated here in your web browser.
+.TP 8
+.B loadURL\fP (class \fBLoadURL\fP)
+This is the shell command used to load a URL into your web browser.
+The default setting will load it into Netscape if it is already running,
+otherwise, will launch a new Netscape looking at the \fIhelpURL\fP.
+.TP 8
 .B nice\fP (class \fBNice\fP)
 The sub-processes created by \fIxscreensaver\fP will be ``niced'' to this
 level, so that they are given lower priority than other processes on the
-system, and don't increase the load unnecessarily.  The default is 20.  
+system, and don't increase the load unnecessarily.  The default is 10.  
 
 (Higher numbers mean lower priority; see 
 .BR nice (1)
@@ -489,6 +511,15 @@ Same as setting the \fIverbose\fP resource to \fItrue\fP.
 .B \-silent
 Same as setting the \fIverbose\fP resource to \fIfalse\fP.
 .TP 8
+.B \-timestamp
+Same as setting the \fItimestamp\fP resource to \fItrue\fP.
+.TP 8
+.B \-splash
+Same as setting the \fIsplash\fP resource to \fItrue\fP.
+.TP 8
+.B \-no\-splash
+Same as setting the \fIsplash\fP resource to \fIfalse\fP.
+.TP 8
 .B \-nice \fIinteger\fP
 Same as the \fInice\fP resource.
 .TP 8
@@ -758,6 +789,7 @@ menu XScreenSaver
  "Blank Screen Now" !"sleep 3; xscreensaver-command -activate"
  "Lock Screen Now"  !"sleep 3; xscreensaver-command -lock"
  "Screen Saver Demo"         !"xscreensaver-command -demo"
+ "Screen Saver Preferences"  !"xscreensaver-command -prefs"
  "Reinitialize Screen Saver" !"xscreensaver-command -restart"
  "Kill Screen Saver"         !"xscreensaver-command -exit"
  "Launch Screen Saver"       !"xscreensaver &"
@@ -1035,7 +1067,7 @@ to get the name of a resource file that overrides the global resources
 stored in the RESOURCE_MANAGER property.
 .SH UPGRADES
 The latest version can always be found at 
-http://people.netscape.com/jwz/xscreensaver/
+http://www.jwz.org/xscreensaver/
 .SH SEE ALSO
 .BR X (1),
 .BR xscreensaver\-command (1),
@@ -1142,7 +1174,7 @@ documentation.  No representations are made about the suitability of this
 software for any purpose.  It is provided "as is" without express or implied
 warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>.  Written in late 1991; first posted
+Jamie Zawinski <jwz@jwz.org>.  Written in late 1991; first posted
 to comp.sources.x on 13-Aug-1992.
 
 Please let me know if you find any bugs or make any improvements.
index 305ce846367944d2d8d4dfb2e4e3ca50a630c59f..d47a841e1abb18aa820d1a5f9cae9e741a5e378c 100644 (file)
@@ -1,5 +1,5 @@
 /* xset.c --- interacting with server extensions and the builtin screensaver.
- * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 
 #include "xscreensaver.h"
 
+#ifdef _VROOT_H_
+ERROR!  You must not include vroot.h in this file.
+#endif
+
 \f
 /* MIT SCREEN-SAVER server extension hackery.
  */
@@ -196,8 +200,9 @@ disable_builtin_screensaver (saver_info *si, Bool turn_off_p)
       desired_allow_exp != current_allow_exp)
     {
       if (desired_server_timeout == 0)
-       printf ("%s%sisabling server builtin screensaver.\n\
-       You can re-enable it with \"xset s on\".\n",
+       fprintf (stderr,
+                "%s%sisabling server builtin screensaver.\n"
+                "\tYou can re-enable it with \"xset s on\".\n",
                (p->verbose_p ? "" : blurb()),
                (p->verbose_p ? "\n\tD" : ": d"));
 
index 1b81c0f8fda5b8ca717a072ffcfa1cd9d9ac0b92..d295b314014ebcd131943f12948b0c7f21f7f42b 100644 (file)
@@ -40,8 +40,8 @@ X_EXTRA_LIBS  = @X_EXTRA_LIBS@
 
 # Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc.
 #
-HACK_PRE       = $(LIBS) $(X_LIBS) $(X_PRE_LIBS)
-HACK_POST      = -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm
+HACK_PRE       = $(LIBS) $(X_LIBS)
+HACK_POST      = $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm
 HACK_LIBS      = $(HACK_PRE)            @HACK_LIBS@ $(HACK_POST)
 XPM_LIBS       = $(HACK_PRE) @XPM_LIBS@ @HACK_LIBS@ $(HACK_POST)
 XLOCK_LIBS     = $(HACK_LIBS)
@@ -58,13 +58,15 @@ UTIL_SRCS   = $(UTILS_SRC)/alpha.c $(UTILS_SRC)/colors.c \
                  $(UTILS_SRC)/resources.c $(UTILS_SRC)/spline.c \
                  $(UTILS_SRC)/usleep.c $(UTILS_SRC)/visual.c \
                  $(UTILS_SRC)/xroger.c $(UTILS_SRC)/yarandom.c \
-                 $(UTILS_SRC)/erase.c $(UTILS_SRC)/sgivideo.c
+                 $(UTILS_SRC)/erase.c $(UTILS_SRC)/sgivideo.c \
+                 $(UTILS_SRC)/xshm.c
 UTIL_OBJS      = $(UTILS_BIN)/alpha.o $(UTILS_BIN)/colors.o \
                  $(UTILS_BIN)/grabscreen.o $(UTILS_BIN)/hsv.o \
                  $(UTILS_BIN)/resources.o $(UTILS_BIN)/spline.o \
                  $(UTILS_BIN)/usleep.o $(UTILS_BIN)/visual.o \
                  $(UTILS_BIN)/xroger.o $(UTILS_BIN)/yarandom.o \
-                 $(UTILS_BIN)/erase.o $(UTILS_BIN)/sgivideo.o
+                 $(UTILS_BIN)/erase.o $(UTILS_BIN)/sgivideo.o \
+                 $(UTILS_SRC)/xshm.o
 
 SRCS           = attraction.c blitspin.c bouboule.c braid.c bubbles.c \
                  bubbles-default.c decayscreen.c deco.c drift.c flag.c \
@@ -111,6 +113,7 @@ XLOCK_OBJS  = screenhack-xlock.o xlockmore.o $(COLOR_OBJS) $(HACK_OBJS_1)
 COLOR_OBJS     = $(UTILS_BIN)/hsv.o $(UTILS_BIN)/colors.o
 GRAB_OBJS_1    = $(UTILS_BIN)/grabscreen.o $(SGI_VIDEO_OBJS)
 GRAB_OBJS      = $(GRAB_OBJS_1) $(COLOR_OBJS)
+XSHM_OBJS      = $(UTILS_BIN)/xshm.o
 GRAB_LIBS      = $(SGI_VIDEO_LIBS)
 
 HDRS           = bubbles.h screenhack.h xlockmore.h xlockmoreI.h
@@ -150,7 +153,7 @@ uninstall: uninstall-program uninstall-man
 install-strip:
        $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
 
-install-program:
+install-program: $(EXES)
        @exes="$(EXES)" ;                                               \
        if [ ! -d $(HACKDIR) ]; then $(INSTALL_DIRS) $(HACKDIR) ; fi ;  \
        for program in $$exes; do                                       \
@@ -158,7 +161,7 @@ install-program:
          $(INSTALL_PROGRAM) $$program $(HACKDIR)/$$program ;           \
        done
 
-install-man:
+install-man: $(MEN)
        @men="$(MEN)" ;                                                 \
        if [ ! -d $(man1dir) ]; then $(INSTALL_DIRS) $(man1dir) ; fi ;  \
        for man in $$men; do                                            \
@@ -185,7 +188,7 @@ clean:
        -rm -f *.o a.out core $(EXES)
 
 distclean: clean
-       -rm -f Makefile *~ "#"*
+       -rm -f Makefile TAGS *~ "#"*
 
 # Adds all current dependencies to Makefile
 depend:
@@ -292,6 +295,7 @@ $(UTILS_BIN)/xmu.o:         $(UTILS_SRC)/xmu.c
 $(UTILS_BIN)/xroger.o:         $(UTILS_SRC)/xroger.c
 $(UTILS_BIN)/yarandom.o:       $(UTILS_SRC)/yarandom.c
 $(UTILS_BIN)/erase.o:          $(UTILS_SRC)/erase.c
+$(UTILS_BIN)/xshm.o:           $(UTILS_SRC)/xshm.c
 
 $(UTIL_OBJS):
        cd $(UTILS_BIN) ; \
@@ -316,6 +320,7 @@ XROG                = $(UTILS_BIN)/xroger.o $(SPL)
 GRAB           = $(GRAB_OBJS)
 ERASE          = $(UTILS_BIN)/erase.o
 COL            = $(COLOR_OBJS)
+SHM            = $(XSHM_OBJS)
 
 CC_HACK                = $(CC) $(LDFLAGS)
 
@@ -372,8 +377,8 @@ lmorph:                      $(HACK_OBJS) lmorph.o
 maze:                   $(HACK_OBJS) maze.o $(ERASE) $(XROG)
        $(CC_HACK) -o $@ $(HACK_OBJS) maze.o $(ERASE) $(XROG) $(HACK_LIBS)
 
-moire:                  $(HACK_OBJS) moire.o $(COL)
-       $(CC_HACK) -o $@ $(HACK_OBJS) moire.o $(COL) $(HACK_LIBS)
+moire:                  $(HACK_OBJS) moire.o $(COL) $(SHM)
+       $(CC_HACK) -o $@ $(HACK_OBJS) moire.o $(COL) $(SHM) $(HACK_LIBS)
 
 moire2:                         $(HACK_OBJS) moire2.o $(COL)
        $(CC_HACK) -o $@ $(HACK_OBJS) moire2.o $(COL) $(HACK_LIBS)
@@ -411,8 +416,8 @@ starfish:            $(HACK_OBJS) starfish.o $(COL) $(SPL)
 munch:                  $(HACK_OBJS) munch.o $(COL) $(SPL)
        $(CC_HACK) -o $@ $(HACK_OBJS) munch.o $(COL) $(SPL) $(HACK_LIBS)
 
-rd-bomb:                $(HACK_OBJS) rd-bomb.o $(COL)
-       $(CC_HACK) -o $@ $(HACK_OBJS) rd-bomb.o $(COL) $(HACK_LIBS)
+rd-bomb:                $(HACK_OBJS) rd-bomb.o $(COL) $(SHM)
+       $(CC_HACK) -o $@ $(HACK_OBJS) rd-bomb.o $(COL) $(SHM) $(HACK_LIBS)
 
 coral: $(HACK_OBJS) coral.o $(COL) $(ERASE)
        $(CC_HACK) -o $@ $(HACK_OBJS) coral.o $(COL) $(ERASE) $(HACK_LIBS)
@@ -432,8 +437,8 @@ cynosure: $(HACK_OBJS) cynosure.o $(COL)
 epicycle: $(HACK_OBJS) epicycle.o $(COL) $(ERASE)
        $(CC_HACK) -o $@ $(HACK_OBJS) epicycle.o $(COL) $(ERASE) $(HACK_LIBS)
 
-interference: $(HACK_OBJS) interference.o $(COL)
-       $(CC_HACK) -o $@ $(HACK_OBJS) interference.o $(COL) $(HACK_LIBS)
+interference: $(HACK_OBJS) interference.o $(COL) $(SHM)
+       $(CC_HACK) -o $@ $(HACK_OBJS) interference.o $(COL) $(SHM) $(HACK_LIBS)
 
 truchet: $(HACK_OBJS) truchet.o $(COL)
        $(CC_HACK) -o $@ $(HACK_OBJS) truchet.o $(COL) $(HACK_LIBS)
@@ -441,8 +446,8 @@ truchet: $(HACK_OBJS) truchet.o $(COL)
 bsod: $(HACK_OBJS) bsod.o $(COL)
        $(CC_HACK) -o $@ $(HACK_OBJS) bsod.o $(COL) $(HACK_LIBS) $(XPM_LIBS)
 
-distort:                $(HACK_OBJS) distort.o $(GRAB)
-       $(CC_HACK) -o $@ $(HACK_OBJS) distort.o $(GRAB) $(HACK_LIBS) $(GRAB_LIBS)
+distort:                $(HACK_OBJS) distort.o $(GRAB) $(SHM)
+       $(CC_HACK) -o $@ $(HACK_OBJS) distort.o $(GRAB) $(SHM) $(HACK_LIBS) $(GRAB_LIBS)
 
 kumppa:                 $(HACK_OBJS) kumppa.o
        $(CC_HACK) -o $@ $(HACK_OBJS) kumppa.o $(HACK_LIBS)
@@ -514,8 +519,8 @@ spiral:             spiral.o        $(XLOCK_OBJS)
 strange:       strange.o       $(XLOCK_OBJS)
        $(CC_HACK) -o $@ $@.o   $(XLOCK_OBJS) $(HACK_LIBS)
 
-swirl:         swirl.o         $(XLOCK_OBJS)
-       $(CC_HACK) -o $@ $@.o   $(XLOCK_OBJS) $(HACK_LIBS)
+swirl:         swirl.o         $(XLOCK_OBJS) $(SHM)
+       $(CC_HACK) -o $@ $@.o   $(XLOCK_OBJS) $(SHM) $(HACK_LIBS)
 
 fadeplot:      fadeplot.o      $(XLOCK_OBJS)
        $(CC_HACK) -o $@ $@.o   $(XLOCK_OBJS) $(HACK_LIBS)
@@ -548,6 +553,7 @@ crystal:    crystal.o               $(XLOCK_OBJS)
 ##############################################################################
 #
 # DO NOT DELETE: updated by make distdepend
+# $(srcdir)/DO $(srcdir)/NOT $(srcdir)/DELETE: $(srcdir)/updated $(srcdir)/by $(srcdir)/make $(srcdir)/distdepend
 
 attraction.o: $(srcdir)/screenhack.h
 attraction.o: ../config.h
@@ -580,6 +586,7 @@ bouboule.o: $(UTILS_SRC)/hsv.h
 bouboule.o: $(UTILS_SRC)/colors.h
 bouboule.o: $(UTILS_SRC)/grabscreen.h
 bouboule.o: $(UTILS_SRC)/visual.h
+bouboule.o: $(UTILS_SRC)/xshm.h
 braid.o: $(srcdir)/xlockmore.h
 braid.o: ../config.h
 braid.o: $(srcdir)/xlockmoreI.h
@@ -591,6 +598,7 @@ braid.o: $(UTILS_SRC)/hsv.h
 braid.o: $(UTILS_SRC)/colors.h
 braid.o: $(UTILS_SRC)/grabscreen.h
 braid.o: $(UTILS_SRC)/visual.h
+braid.o: $(UTILS_SRC)/xshm.h
 braid.o: $(UTILS_SRC)/erase.h
 bubbles.o: $(srcdir)/screenhack.h
 bubbles.o: ../config.h
@@ -678,6 +686,7 @@ drift.o: $(UTILS_SRC)/hsv.h
 drift.o: $(UTILS_SRC)/colors.h
 drift.o: $(UTILS_SRC)/grabscreen.h
 drift.o: $(UTILS_SRC)/visual.h
+drift.o: $(UTILS_SRC)/xshm.h
 drift.o: $(UTILS_SRC)/erase.h
 flag.o: $(srcdir)/xlockmore.h
 flag.o: ../config.h
@@ -690,6 +699,7 @@ flag.o: $(UTILS_SRC)/hsv.h
 flag.o: $(UTILS_SRC)/colors.h
 flag.o: $(UTILS_SRC)/grabscreen.h
 flag.o: $(UTILS_SRC)/visual.h
+flag.o: $(UTILS_SRC)/xshm.h
 flag.o: $(srcdir)/images/bob.xbm
 flame.o: $(srcdir)/screenhack.h
 flame.o: ../config.h
@@ -711,6 +721,7 @@ forest.o: $(UTILS_SRC)/hsv.h
 forest.o: $(UTILS_SRC)/colors.h
 forest.o: $(UTILS_SRC)/grabscreen.h
 forest.o: $(UTILS_SRC)/visual.h
+forest.o: $(UTILS_SRC)/xshm.h
 forest.o: $(UTILS_SRC)/erase.h
 vines.o: $(srcdir)/xlockmore.h
 vines.o: ../config.h
@@ -723,6 +734,7 @@ vines.o: $(UTILS_SRC)/hsv.h
 vines.o: $(UTILS_SRC)/colors.h
 vines.o: $(UTILS_SRC)/grabscreen.h
 vines.o: $(UTILS_SRC)/visual.h
+vines.o: $(UTILS_SRC)/xshm.h
 vines.o: $(UTILS_SRC)/erase.h
 galaxy.o: $(srcdir)/xlockmore.h
 galaxy.o: ../config.h
@@ -735,6 +747,7 @@ galaxy.o: $(UTILS_SRC)/hsv.h
 galaxy.o: $(UTILS_SRC)/colors.h
 galaxy.o: $(UTILS_SRC)/grabscreen.h
 galaxy.o: $(UTILS_SRC)/visual.h
+galaxy.o: $(UTILS_SRC)/xshm.h
 grav.o: $(srcdir)/xlockmore.h
 grav.o: ../config.h
 grav.o: $(srcdir)/xlockmoreI.h
@@ -746,6 +759,7 @@ grav.o: $(UTILS_SRC)/hsv.h
 grav.o: $(UTILS_SRC)/colors.h
 grav.o: $(UTILS_SRC)/grabscreen.h
 grav.o: $(UTILS_SRC)/visual.h
+grav.o: $(UTILS_SRC)/xshm.h
 greynetic.o: $(srcdir)/screenhack.h
 greynetic.o: ../config.h
 greynetic.o: $(UTILS_SRC)/yarandom.h
@@ -785,6 +799,7 @@ hopalong.o: $(UTILS_SRC)/hsv.h
 hopalong.o: $(UTILS_SRC)/colors.h
 hopalong.o: $(UTILS_SRC)/grabscreen.h
 hopalong.o: $(UTILS_SRC)/visual.h
+hopalong.o: $(UTILS_SRC)/xshm.h
 hopalong.o: $(UTILS_SRC)/erase.h
 hypercube.o: $(srcdir)/screenhack.h
 hypercube.o: ../config.h
@@ -806,6 +821,7 @@ ifs.o: $(UTILS_SRC)/hsv.h
 ifs.o: $(UTILS_SRC)/colors.h
 ifs.o: $(UTILS_SRC)/grabscreen.h
 ifs.o: $(UTILS_SRC)/visual.h
+ifs.o: $(UTILS_SRC)/xshm.h
 imsmap.o: $(srcdir)/screenhack.h
 imsmap.o: ../config.h
 imsmap.o: $(UTILS_SRC)/yarandom.h
@@ -826,6 +842,7 @@ julia.o: $(UTILS_SRC)/hsv.h
 julia.o: $(UTILS_SRC)/colors.h
 julia.o: $(UTILS_SRC)/grabscreen.h
 julia.o: $(UTILS_SRC)/visual.h
+julia.o: $(UTILS_SRC)/xshm.h
 kaleidescope.o: $(UTILS_SRC)/spline.h
 kaleidescope.o: $(srcdir)/screenhack.h
 kaleidescope.o: ../config.h
@@ -847,6 +864,7 @@ laser.o: $(UTILS_SRC)/hsv.h
 laser.o: $(UTILS_SRC)/colors.h
 laser.o: $(UTILS_SRC)/grabscreen.h
 laser.o: $(UTILS_SRC)/visual.h
+laser.o: $(UTILS_SRC)/xshm.h
 lightning.o: $(srcdir)/xlockmore.h
 lightning.o: ../config.h
 lightning.o: $(srcdir)/xlockmoreI.h
@@ -858,6 +876,7 @@ lightning.o: $(UTILS_SRC)/hsv.h
 lightning.o: $(UTILS_SRC)/colors.h
 lightning.o: $(UTILS_SRC)/grabscreen.h
 lightning.o: $(UTILS_SRC)/visual.h
+lightning.o: $(UTILS_SRC)/xshm.h
 lisa.o: $(srcdir)/xlockmore.h
 lisa.o: ../config.h
 lisa.o: $(srcdir)/xlockmoreI.h
@@ -869,6 +888,7 @@ lisa.o: $(UTILS_SRC)/hsv.h
 lisa.o: $(UTILS_SRC)/colors.h
 lisa.o: $(UTILS_SRC)/grabscreen.h
 lisa.o: $(UTILS_SRC)/visual.h
+lisa.o: $(UTILS_SRC)/xshm.h
 lmorph.o: $(srcdir)/screenhack.h
 lmorph.o: ../config.h
 lmorph.o: $(UTILS_SRC)/yarandom.h
@@ -897,6 +917,7 @@ moire.o: $(UTILS_SRC)/hsv.h
 moire.o: $(UTILS_SRC)/colors.h
 moire.o: $(UTILS_SRC)/grabscreen.h
 moire.o: $(UTILS_SRC)/visual.h
+moire.o: $(UTILS_SRC)/xshm.h
 noseguy.o: $(srcdir)/screenhack.h
 noseguy.o: ../config.h
 noseguy.o: $(UTILS_SRC)/yarandom.h
@@ -934,6 +955,7 @@ penrose.o: $(UTILS_SRC)/hsv.h
 penrose.o: $(UTILS_SRC)/colors.h
 penrose.o: $(UTILS_SRC)/grabscreen.h
 penrose.o: $(UTILS_SRC)/visual.h
+penrose.o: $(UTILS_SRC)/xshm.h
 pyro.o: $(srcdir)/screenhack.h
 pyro.o: ../config.h
 pyro.o: $(UTILS_SRC)/yarandom.h
@@ -995,6 +1017,7 @@ sierpinski.o: $(UTILS_SRC)/hsv.h
 sierpinski.o: $(UTILS_SRC)/colors.h
 sierpinski.o: $(UTILS_SRC)/grabscreen.h
 sierpinski.o: $(UTILS_SRC)/visual.h
+sierpinski.o: $(UTILS_SRC)/xshm.h
 slidescreen.o: $(srcdir)/screenhack.h
 slidescreen.o: ../config.h
 slidescreen.o: $(UTILS_SRC)/yarandom.h
@@ -1015,6 +1038,7 @@ slip.o: $(UTILS_SRC)/hsv.h
 slip.o: $(UTILS_SRC)/colors.h
 slip.o: $(UTILS_SRC)/grabscreen.h
 slip.o: $(UTILS_SRC)/visual.h
+slip.o: $(UTILS_SRC)/xshm.h
 sphere.o: $(srcdir)/xlockmore.h
 sphere.o: ../config.h
 sphere.o: $(srcdir)/xlockmoreI.h
@@ -1026,6 +1050,7 @@ sphere.o: $(UTILS_SRC)/hsv.h
 sphere.o: $(UTILS_SRC)/colors.h
 sphere.o: $(UTILS_SRC)/grabscreen.h
 sphere.o: $(UTILS_SRC)/visual.h
+sphere.o: $(UTILS_SRC)/xshm.h
 spiral.o: $(srcdir)/xlockmore.h
 spiral.o: ../config.h
 spiral.o: $(srcdir)/xlockmoreI.h
@@ -1037,6 +1062,7 @@ spiral.o: $(UTILS_SRC)/hsv.h
 spiral.o: $(UTILS_SRC)/colors.h
 spiral.o: $(UTILS_SRC)/grabscreen.h
 spiral.o: $(UTILS_SRC)/visual.h
+spiral.o: $(UTILS_SRC)/xshm.h
 strange.o: $(srcdir)/xlockmore.h
 strange.o: ../config.h
 strange.o: $(srcdir)/xlockmoreI.h
@@ -1048,6 +1074,7 @@ strange.o: $(UTILS_SRC)/hsv.h
 strange.o: $(UTILS_SRC)/colors.h
 strange.o: $(UTILS_SRC)/grabscreen.h
 strange.o: $(UTILS_SRC)/visual.h
+strange.o: $(UTILS_SRC)/xshm.h
 swirl.o: $(srcdir)/xlockmore.h
 swirl.o: ../config.h
 swirl.o: $(srcdir)/xlockmoreI.h
@@ -1059,6 +1086,7 @@ swirl.o: $(UTILS_SRC)/hsv.h
 swirl.o: $(UTILS_SRC)/colors.h
 swirl.o: $(UTILS_SRC)/grabscreen.h
 swirl.o: $(UTILS_SRC)/visual.h
+swirl.o: $(UTILS_SRC)/xshm.h
 xlockmore.o: $(srcdir)/screenhack.h
 xlockmore.o: ../config.h
 xlockmore.o: $(UTILS_SRC)/yarandom.h
@@ -1069,6 +1097,7 @@ xlockmore.o: $(UTILS_SRC)/colors.h
 xlockmore.o: $(UTILS_SRC)/grabscreen.h
 xlockmore.o: $(UTILS_SRC)/visual.h
 xlockmore.o: $(srcdir)/xlockmoreI.h
+xlockmore.o: $(UTILS_SRC)/xshm.h
 xroger-hack.o: $(srcdir)/screenhack.h
 xroger-hack.o: ../config.h
 xroger-hack.o: $(UTILS_SRC)/yarandom.h
@@ -1119,6 +1148,7 @@ fadeplot.o: $(UTILS_SRC)/hsv.h
 fadeplot.o: $(UTILS_SRC)/colors.h
 fadeplot.o: $(UTILS_SRC)/grabscreen.h
 fadeplot.o: $(UTILS_SRC)/visual.h
+fadeplot.o: $(UTILS_SRC)/xshm.h
 rd-bomb.o: $(srcdir)/screenhack.h
 rd-bomb.o: ../config.h
 rd-bomb.o: $(UTILS_SRC)/yarandom.h
@@ -1128,6 +1158,7 @@ rd-bomb.o: $(UTILS_SRC)/hsv.h
 rd-bomb.o: $(UTILS_SRC)/colors.h
 rd-bomb.o: $(UTILS_SRC)/grabscreen.h
 rd-bomb.o: $(UTILS_SRC)/visual.h
+rd-bomb.o: $(UTILS_SRC)/xshm.h
 coral.o: $(srcdir)/screenhack.h
 coral.o: ../config.h
 coral.o: $(UTILS_SRC)/yarandom.h
@@ -1149,6 +1180,7 @@ mountain.o: $(UTILS_SRC)/hsv.h
 mountain.o: $(UTILS_SRC)/colors.h
 mountain.o: $(UTILS_SRC)/grabscreen.h
 mountain.o: $(UTILS_SRC)/visual.h
+mountain.o: $(UTILS_SRC)/xshm.h
 triangle.o: $(srcdir)/xlockmore.h
 triangle.o: ../config.h
 triangle.o: $(srcdir)/xlockmoreI.h
@@ -1160,6 +1192,7 @@ triangle.o: $(UTILS_SRC)/hsv.h
 triangle.o: $(UTILS_SRC)/colors.h
 triangle.o: $(UTILS_SRC)/grabscreen.h
 triangle.o: $(UTILS_SRC)/visual.h
+triangle.o: $(UTILS_SRC)/xshm.h
 lissie.o: $(srcdir)/xlockmore.h
 lissie.o: ../config.h
 lissie.o: $(srcdir)/xlockmoreI.h
@@ -1171,6 +1204,7 @@ lissie.o: $(UTILS_SRC)/hsv.h
 lissie.o: $(UTILS_SRC)/colors.h
 lissie.o: $(UTILS_SRC)/grabscreen.h
 lissie.o: $(UTILS_SRC)/visual.h
+lissie.o: $(UTILS_SRC)/xshm.h
 worm.o: $(srcdir)/xlockmore.h
 worm.o: ../config.h
 worm.o: $(srcdir)/xlockmoreI.h
@@ -1182,6 +1216,7 @@ worm.o: $(UTILS_SRC)/hsv.h
 worm.o: $(UTILS_SRC)/colors.h
 worm.o: $(UTILS_SRC)/grabscreen.h
 worm.o: $(UTILS_SRC)/visual.h
+worm.o: $(UTILS_SRC)/xshm.h
 rotor.o: $(srcdir)/xlockmore.h
 rotor.o: ../config.h
 rotor.o: $(srcdir)/xlockmoreI.h
@@ -1193,6 +1228,7 @@ rotor.o: $(UTILS_SRC)/hsv.h
 rotor.o: $(UTILS_SRC)/colors.h
 rotor.o: $(UTILS_SRC)/grabscreen.h
 rotor.o: $(UTILS_SRC)/visual.h
+rotor.o: $(UTILS_SRC)/xshm.h
 ant.o: $(srcdir)/xlockmore.h
 ant.o: ../config.h
 ant.o: $(srcdir)/xlockmoreI.h
@@ -1204,6 +1240,7 @@ ant.o: $(UTILS_SRC)/hsv.h
 ant.o: $(UTILS_SRC)/colors.h
 ant.o: $(UTILS_SRC)/grabscreen.h
 ant.o: $(UTILS_SRC)/visual.h
+ant.o: $(UTILS_SRC)/xshm.h
 ant.o: $(UTILS_SRC)/erase.h
 xjack.o: $(srcdir)/screenhack.h
 xjack.o: ../config.h
@@ -1299,6 +1336,7 @@ flow.o: $(UTILS_SRC)/hsv.h
 flow.o: $(UTILS_SRC)/colors.h
 flow.o: $(UTILS_SRC)/grabscreen.h
 flow.o: $(UTILS_SRC)/visual.h
+flow.o: $(UTILS_SRC)/xshm.h
 flow.o: $(UTILS_SRC)/erase.h
 epicycle.o: $(srcdir)/screenhack.h
 epicycle.o: ../config.h
@@ -1338,6 +1376,7 @@ bsod.o: $(UTILS_SRC)/colors.h
 bsod.o: $(UTILS_SRC)/grabscreen.h
 bsod.o: $(UTILS_SRC)/visual.h
 bsod.o: $(srcdir)/images/amiga.xpm
+bsod.o: $(srcdir)/images/atari.xbm
 bsod.o: $(srcdir)/images/mac.xbm
 crystal.o: $(srcdir)/xlockmore.h
 crystal.o: ../config.h
@@ -1350,6 +1389,7 @@ crystal.o: $(UTILS_SRC)/hsv.h
 crystal.o: $(UTILS_SRC)/colors.h
 crystal.o: $(UTILS_SRC)/grabscreen.h
 crystal.o: $(UTILS_SRC)/visual.h
+crystal.o: $(UTILS_SRC)/xshm.h
 discrete.o: $(srcdir)/xlockmore.h
 discrete.o: ../config.h
 discrete.o: $(srcdir)/xlockmoreI.h
@@ -1361,6 +1401,7 @@ discrete.o: $(UTILS_SRC)/hsv.h
 discrete.o: $(UTILS_SRC)/colors.h
 discrete.o: $(UTILS_SRC)/grabscreen.h
 discrete.o: $(UTILS_SRC)/visual.h
+discrete.o: $(UTILS_SRC)/xshm.h
 discrete.o: $(UTILS_SRC)/erase.h
 distort.o: $(srcdir)/screenhack.h
 distort.o: ../config.h
@@ -1371,6 +1412,7 @@ distort.o: $(UTILS_SRC)/hsv.h
 distort.o: $(UTILS_SRC)/colors.h
 distort.o: $(UTILS_SRC)/grabscreen.h
 distort.o: $(UTILS_SRC)/visual.h
+distort.o: $(UTILS_SRC)/xshm.h
 kumppa.o: $(srcdir)/screenhack.h
 kumppa.o: ../config.h
 kumppa.o: $(UTILS_SRC)/yarandom.h
index d5070d24a0305a6445abd1857c891da376973ba6..2818fceca4fda5f20ed36bc0d77c0419dc9f5fbd 100644 (file)
@@ -5,7 +5,7 @@
  */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)ant.c        4.04 97/07/28 xlockmore";
+static const char sccsid[] = "@(#)ant.c        4.11 98/06/18 xlockmore";
 
 #endif
 
@@ -45,9 +45,9 @@ static const char sccsid[] = "@(#)ant.c       4.04 97/07/28 xlockmore";
 /*-
   Species Grid     Number of Neigbors
   ------- ----     ------------------
-  Ants    Square   4 or 8
+  Ants    Square   4 (or 8)
   Bees    Hexagon  6
-  Bees    Triangle 3 (9? or 12) <- 9 and 12 are not implemented
+  Bees    Triangle 3 (or 9, 12)
 
   Neighbors 6 and neighbors 3 produce the same Turk ants.
 */
@@ -60,16 +60,21 @@ static const char sccsid[] = "@(#)ant.c     4.04 97/07/28 xlockmore";
 # define DEFAULTS      "*delay:   1000 \n"             \
                                        "*count:  -3 \n"                \
                                        "*cycles:  40000 \n"    \
-                                       "*size:   -7 \n"                \
-                                       "*ncolors: 64 \n"
+                                       "*size:   -12 \n"               \
+                                       "*ncolors: 64 \n"               \
+                                       "*neighbors: 0 \n"              \
+                                       "*sharpturn: False \n"
 # include "xlockmore.h"                /* in xscreensaver distribution */
 # include "erase.h"
 #else /* STANDALONE */
 # include "xlock.h"            /* in xlockmore distribution */
-
+# include "automata.h"
 #endif /* STANDALONE */
 
-#define DEF_TRUCHET  "True"
+/*-
+ * neighbors of 0 randomizes it between 3, 4 and 6.
+ * 8, 9 12 are available also but not recommended.
+ */
 
 #ifdef STANDALONE
 static int neighbors;
@@ -77,34 +82,50 @@ static int neighbors;
 extern int  neighbors;
 #endif /* !STANDALONE */
 
+#define DEF_TRUCHET  "False"
+#define DEF_SHARPTURN  "False"
+
 static Bool truchet;
+static Bool sharpturn;
 
 static XrmOptionDescRec opts[] =
 {
        {"-truchet", ".ant.truchet", XrmoptionNoArg, (caddr_t) "on"},
        {"+truchet", ".ant.truchet", XrmoptionNoArg, (caddr_t) "off"},
+       {"-sharpturn", ".ant.sharpturn", XrmoptionNoArg, (caddr_t) "on"},
+       {"+sharpturn", ".ant.sharpturn", XrmoptionNoArg, (caddr_t) "off"},
 
 #ifdef STANDALONE
-       {"-neighbors", ".ant.neighbors", XrmoptionNoArg, (caddr_t) "on"},
-       {"+neighbors", ".ant.neighbors", XrmoptionNoArg, (caddr_t) "off"}
+       {"-neighbors", ".ant.neighbors", XrmoptionSepArg, (caddr_t) 0},
+       {"+neighbors", ".ant.neighbors", XrmoptionSepArg, (caddr_t) 0}
 #endif /* STANDALONE */
 
 };
 static argtype vars[] =
 {
        {(caddr_t *) & truchet, "truchet", "Truchet", DEF_TRUCHET, t_Bool},
+   {(caddr_t *) & sharpturn, "sharpturn", "SharpTurn", DEF_SHARPTURN, t_Bool},
 #ifdef STANDALONE
-       {(caddr_t *) & neighbors, "neighbors", "Neighbors", 0, t_Bool}
+       {(caddr_t *) & neighbors, "neighbors", "Neighbors", 0, t_Int}
 #endif /* STANDALONE */
 };
 static OptionStruct desc[] =
 {
-       {"-/+truchet", "turn on/off Truchet lines"}
+       {"-/+truchet", "turn on/off Truchet lines"},
+       {"-/+sharpturn", "turn on/off sharp turns (6 or 12 neighbors only)"}
 };
 
 ModeSpecOpt ant_opts =
-{2, opts, 1, vars, desc};
+{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
+
+#ifdef USE_MODULES
+ModStruct   ant_description =
+{"ant", "init_ant", "draw_ant", "release_ant",
+ "refresh_ant", "init_ant", NULL, &ant_opts,
+ 1000, -3, 40000, -12, 64, 1.0, "",
+ "Shows Langton's and Turk's generalized ants", 0, NULL};
 
+#endif
 
 #define ANTBITS(n,w,h)\
   ap->pixmaps[ap->init_bits++]=\
@@ -112,16 +133,18 @@ ModeSpecOpt ant_opts =
 
 /* If you change the table you may have to change the following 2 constants */
 #define STATES 2
-#define COLORS 11
 #define MINANTS 1
-#define PATTERNSIZE 8
 #define REDRAWSTEP 2000                /* How much tape to draw per cycle */
 #define MINGRIDSIZE 24
 #define MINSIZE 1
+#define MINRANDOMSIZE 5
 #define ANGLES 360
-#define NEIGHBORKINDS 2
 
 #ifdef STANDALONE
+
+#define NUMSTIPPLES 11
+#define STIPPLESIZE 8
+
 static XPoint hexagonUnit[6] =
 {
        {0, 0},
@@ -146,23 +169,24 @@ static XPoint triangleUnit[2][3] =
        }
 };
 
-#endif /* STANDALONE */
-
 
-static unsigned char patterns[COLORS - 1][PATTERNSIZE] =
+static unsigned char stipples[NUMSTIPPLES][STIPPLESIZE] =
 {
+       {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},       /* white */
        {0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22},       /* grey+white | stripe */
        {0x00, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00},       /* spots */
-       {0x89, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11},       /* lt. / stripe */
+       {0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11},       /* lt. / stripe */
        {0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66},       /* | bars */
        {0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa},       /* 50% grey */
        {0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00},       /* - bars */
-       {0xee, 0xdd, 0xbb, 0x77, 0xee, 0xdd, 0xbb, 0x76},       /* dark \ stripe */
+       {0xee, 0xdd, 0xbb, 0x77, 0xee, 0xdd, 0xbb, 0x77},       /* dark \ stripe */
        {0xff, 0x99, 0x99, 0xff, 0xff, 0x99, 0x99, 0xff},       /* spots */
        {0xaa, 0xff, 0xff, 0x55, 0xaa, 0xff, 0xff, 0x55},       /* black+grey - stripe */
        {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}        /* black */
 };
 
+#endif /* STANDALONE */
+
 typedef struct {
        unsigned char color;
        short       direction;
@@ -176,7 +200,7 @@ typedef struct {
 } antstruct;
 
 typedef struct {
-       int         init_bits;
+       Bool        painted;
        int         neighbors;
        int         generation;
        int         xs, ys;
@@ -187,20 +211,29 @@ typedef struct {
        int         n;
        int         redrawing, redrawpos;
        int         truchet;    /* Only for Turk modes */
-       statestruct machine[COLORS * STATES];
+       int         sharpturn;  /* Only for even neighbors > 4 (i.e. 6 and 12) */
+       statestruct machine[NUMSTIPPLES * STATES];
        unsigned char *tape;
        unsigned char *truchet_state;
        antstruct  *ants;
-       unsigned char colors[COLORS - 1];
+       int         init_bits;
+       unsigned char colors[NUMSTIPPLES - 1];
        GC          stippledGC;
-       Pixmap      pixmaps[COLORS - 1];
-       XPoint      hexagonList[7];
-       XPoint      triangleList[2][4];
+       Pixmap      pixmaps[NUMSTIPPLES - 1];
+       union {
+               XPoint      hexagon[7];         /* Need more than 6 for truchet */
+               XPoint      triangle[2][4];     /* Need more than 3 for truchet */
+       } shape;
 } antfarmstruct;
 
-static int  initVal[NEIGHBORKINDS] =
-{3, 6};                        /* Neighborhoods, 8 just makes a mess */
+static char plots[] =
+{3,
+#if 1                          /* Without this... this mode is misnamed... */
+ 4,
+#endif
+ 6};                           /* Neighborhoods, 8 just makes a mess */
 
+#define NEIGHBORKINDS (long) (sizeof plots / sizeof *plots)
 
 /* Relative ant moves */
 #define FS 0                   /* Step */
@@ -233,7 +266,7 @@ static antfarmstruct *antfarms = NULL;
 /* Even runs of 0's and 1's are also symmetric */
 /* I have seen Hexagonal builders but they are more rare. */
 
-static unsigned char tables[][3 * COLORS * STATES + 2] =
+static unsigned char tables[][3 * NUMSTIPPLES * STATES + 2] =
 {
 #if 0
   /* Here just so you can figure out notation */
@@ -492,35 +525,34 @@ fillcell(ModeInfo * mi, GC gc, int col, int row)
        if (ap->neighbors == 6) {
                int         ccol = 2 * col + !(row & 1), crow = 2 * row;
 
-               ap->hexagonList[0].x = ap->xb + ccol * ap->xs;
-               ap->hexagonList[0].y = ap->yb + crow * ap->ys;
+               ap->shape.hexagon[0].x = ap->xb + ccol * ap->xs;
+               ap->shape.hexagon[0].y = ap->yb + crow * ap->ys;
                if (ap->xs == 1 && ap->ys == 1)
                        XFillRectangle(MI_DISPLAY(mi), MI_WINDOW(mi), gc,
-                          ap->hexagonList[0].x, ap->hexagonList[0].y, 1, 1);
+                       ap->shape.hexagon[0].x, ap->shape.hexagon[0].y, 1, 1);
                else
                        XFillPolygon(MI_DISPLAY(mi), MI_WINDOW(mi), gc,
-                             ap->hexagonList, 6, Convex, CoordModePrevious);
-
+                           ap->shape.hexagon, 6, Convex, CoordModePrevious);
        } else if (ap->neighbors == 4 || ap->neighbors == 8) {
                XFillRectangle(MI_DISPLAY(mi), MI_WINDOW(mi), gc,
-               ap->xb + ap->xs * col, ap->yb + ap->ys * row, ap->xs, ap->ys);
-
+               ap->xb + ap->xs * col, ap->yb + ap->ys * row,
+               ap->xs - (ap->xs > 3), ap->ys - (ap->ys > 3));
        } else {                /* TRI */
                int         orient = (col + row) % 2;   /* O left 1 right */
 
-               ap->triangleList[orient][0].x = ap->xb + col * ap->xs;
-               ap->triangleList[orient][0].y = ap->yb + row * ap->ys;
+               ap->shape.triangle[orient][0].x = ap->xb + col * ap->xs;
+               ap->shape.triangle[orient][0].y = ap->yb + row * ap->ys;
                if (ap->xs <= 3 || ap->ys <= 3)
                        XFillRectangle(MI_DISPLAY(mi), MI_WINDOW(mi), gc,
-                        ((orient) ? -1 : 1) + ap->triangleList[orient][0].x,
-                                      ap->triangleList[orient][0].y, 1, 1);
+                       ((orient) ? -1 : 1) + ap->shape.triangle[orient][0].x,
+                                      ap->shape.triangle[orient][0].y, 1, 1);
                else {
                        if (orient)
-                               ap->triangleList[orient][0].x += (ap->xs / 2 - 1);
+                               ap->shape.triangle[orient][0].x += (ap->xs / 2 - 1);
                        else
-                               ap->triangleList[orient][0].x -= (ap->xs / 2 - 1);
+                               ap->shape.triangle[orient][0].x -= (ap->xs / 2 - 1);
                        XFillPolygon(MI_DISPLAY(mi), MI_WINDOW(mi), gc,
-                                    ap->triangleList[orient], 3, Convex, CoordModePrevious);
+                                    ap->shape.triangle[orient], 3, Convex, CoordModePrevious);
                }
        }
 }
@@ -531,77 +563,96 @@ truchetcell(ModeInfo * mi, int col, int row, int truchetstate)
        antfarmstruct *ap = &antfarms[MI_SCREEN(mi)];
 
        if (ap->neighbors == 6) {
+
                int         ccol = 2 * col + !(row & 1), crow = 2 * row;
                int         side;
+               int         fudge = 7;  /* fudge because the hexagons are not exact */
                XPoint      hex, hex2;
 
-               /* Very crude approx of Sqrt 3, so it will not cause drawing errors. */
-               hex.x = ap->xb + ccol * ap->xs - (int) ((double) ap->xs * 1.6 / 2.0);
-               hex.y = ap->yb + crow * ap->ys - (int) ((double) ap->ys * 1.6 / 2.0);
-               for (side = 0; side < 6; side++) {
-                       if (side > 0) {
-                               hex.x += ap->hexagonList[side].x;
-                               hex.y += ap->hexagonList[side].y;
+               if (ap->sharpturn) {
+                       hex.x = ap->xb + ccol * ap->xs - (int) ((double) ap->xs / 2.0) - 1;
+                       hex.y = ap->yb + crow * ap->ys - (int) ((double) ap->ys / 2.0) - 1;
+                       for (side = 0; side < 6; side++) {
+                               if (side > 0) {
+                                       hex.x += ap->shape.hexagon[side].x;
+                                       hex.y += ap->shape.hexagon[side].y;
+                               }
+                               if (truchetstate == side % 2)
+                                       XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
+                                                hex.x, hex.y, ap->xs, ap->ys,
+                                                ((570 - (side * 60) + fudge) % 360) * 64, (120 - 2 * fudge) * 64);
+                       }
+               } else {
+
+                       /* Very crude approx of Sqrt 3, so it will not cause drawing errors. */
+                       hex.x = ap->xb + ccol * ap->xs - (int) ((double) ap->xs * 1.6 / 2.0);
+                       hex.y = ap->yb + crow * ap->ys - (int) ((double) ap->ys * 1.6 / 2.0);
+                       for (side = 0; side < 6; side++) {
+                               if (side > 0) {
+                                       hex.x += ap->shape.hexagon[side].x;
+                                       hex.y += ap->shape.hexagon[side].y;
+                               }
+                               hex2.x = hex.x + ap->shape.hexagon[side + 1].x / 2;
+                               hex2.y = hex.y + ap->shape.hexagon[side + 1].y / 2;
+                               if (truchetstate == side % 3)
+                                       /* Crude approx of 120 deg, so it will not cause drawing errors. */
+                                       XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
+                                                hex2.x, hex2.y,
+                                                (int) ((double) ap->xs * 1.5), (int) ((double) ap->ys * 1.5),
+                                                ((555 - (side * 60)) % 360) * 64, 90 * 64);
                        }
-                       hex2.x = hex.x + ap->hexagonList[side + 1].x / 2;
-                       hex2.y = hex.y + ap->hexagonList[side + 1].y / 2;
-                       if (truchetstate == side % 3)
-                               /* Crude approx of 120 deg, so it will not cause drawing errors. */
-                               XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
-                                        hex2.x, hex2.y,
-                                        (int) ((double) ap->xs * 1.5), (int) ((double) ap->ys * 1.5),
-                                 ((555 - (side * 60)) % 360) * 64, 90 * 64);
                }
        } else if (ap->neighbors == 4) {
                if (truchetstate) {
                        XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
-                                ap->xb + ap->xs * col - ap->xs / 2,
-                                ap->yb + ap->ys * row + ap->ys / 2,
-                                ap->xs, ap->ys,
-                                1 * 64, 88 * 64);
+                                ap->xb + ap->xs * col - ap->xs / 2+ 1,
+                                ap->yb + ap->ys * row + ap->ys / 2 - 1,
+                                ap->xs - 2, ap->ys - 2,
+                                0 * 64, 90 * 64);
                        XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
-                                ap->xb + ap->xs * col + ap->xs / 2,
-                                ap->yb + ap->ys * row - ap->ys / 2,
-                                ap->xs, ap->ys,
-                                -91 * 64, -88 * 64);
+                                ap->xb + ap->xs * col + ap->xs / 2 - 1,
+                                ap->yb + ap->ys * row - ap->ys / 2 + 1,
+                                ap->xs - 2, ap->ys - 2,
+                                -90 * 64, -90 * 64);
                } else {
                        XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
-                                ap->xb + ap->xs * col - ap->xs / 2,
-                                ap->yb + ap->ys * row - ap->ys / 2,
-                                ap->xs, ap->ys,
-                                -1 * 64, -88 * 64);
+                                ap->xb + ap->xs * col - ap->xs / 2 + 1,
+                                ap->yb + ap->ys * row - ap->ys / 2 + 1,
+                                ap->xs - 2, ap->ys - 2,
+                                0 * 64, -90 * 64);
                        XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
-                                ap->xb + ap->xs * col + ap->xs / 2,
-                                ap->yb + ap->ys * row + ap->ys / 2,
-                                ap->xs, ap->ys,
-                                91 * 64, 88 * 64);
+                                ap->xb + ap->xs * col + ap->xs / 2 - 1,
+                                ap->yb + ap->ys * row + ap->ys / 2 - 1,
+                                ap->xs - 2, ap->ys - 2,
+                                90 * 64, 90 * 64);
                }
        } else if (ap->neighbors == 3) {
                int         orient = (col + row) % 2;   /* O left 1 right */
                int         side, ang;
+               int         fudge = 7;  /* fudge because the triangles are not exact */
                XPoint      tri;
 
                tri.x = ap->xb + col * ap->xs;
                tri.y = ap->yb + row * ap->ys;
                if (orient) {
-                       tri.x += (ap->xs / 2 - 2);
+                       tri.x += (ap->xs / 2 - 1);
                } else {
-                       tri.x -= (ap->xs / 2 + 2);
+                       tri.x -= (ap->xs / 2 - 1);
                }
                for (side = 0; side < 3; side++) {
                        if (side > 0) {
-                               tri.x += ap->triangleList[orient][side].x;
-                               tri.y += ap->triangleList[orient][side].y;
+                               tri.x += ap->shape.triangle[orient][side].x;
+                               tri.y += ap->shape.triangle[orient][side].y;
                        }
                        if (truchetstate == side % 3) {
                                if (orient)
-                                       ang = (518 - side * 120) % 360;         /* Right */
+                                       ang = (510 - side * 120) % 360;         /* Right */
                                else
                                        ang = (690 - side * 120) % 360;         /* Left */
                                XDrawArc(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
                                  tri.x - ap->xs / 2, tri.y - 3 * ap->ys / 4,
                                         ap->xs, 3 * ap->ys / 2,
-                                        ang * 64, 45 * 64);
+                                 (ang + fudge) * 64, (60 - 2 * fudge) * 64);
                        }
                }
        }
@@ -611,10 +662,10 @@ static void
 drawcell(ModeInfo * mi, int col, int row, unsigned char color)
 {
        antfarmstruct *ap = &antfarms[MI_SCREEN(mi)];
-  GC gc;
+       GC          gc;
 
        if (!color) {
-               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
+               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_BLACK_PIXEL(mi));
                gc = MI_GC(mi);
        } else if (MI_NPIXELS(mi) > 2) {
                XSetForeground(MI_DISPLAY(mi), MI_GC(mi),
@@ -624,8 +675,8 @@ drawcell(ModeInfo * mi, int col, int row, unsigned char color)
                XGCValues   gcv;
 
                gcv.stipple = ap->pixmaps[color - 1];
-               gcv.foreground = MI_WIN_WHITE_PIXEL(mi);
-               gcv.background = MI_WIN_BLACK_PIXEL(mi);
+               gcv.foreground = MI_WHITE_PIXEL(mi);
+               gcv.background = MI_BLACK_PIXEL(mi);
                XChangeGC(MI_DISPLAY(mi), ap->stippledGC,
                          GCStipple | GCForeground | GCBackground, &gcv);
                gc = ap->stippledGC;
@@ -640,18 +691,18 @@ drawtruchet(ModeInfo * mi, int col, int row,
        antfarmstruct *ap = &antfarms[MI_SCREEN(mi)];
 
        if (!color)
-               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_WHITE_PIXEL(mi));
+               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WHITE_PIXEL(mi));
        else if (MI_NPIXELS(mi) > 2 || color > ap->ncolors / 2)
-               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
+               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_BLACK_PIXEL(mi));
        else
-               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_WHITE_PIXEL(mi));
+               XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WHITE_PIXEL(mi));
        truchetcell(mi, col, row, truchetstate);
 }
 
 static void
 draw_anant(ModeInfo * mi, int col, int row)
 {
-       XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WIN_WHITE_PIXEL(mi));
+       XSetForeground(MI_DISPLAY(mi), MI_GC(mi), MI_WHITE_PIXEL(mi));
        fillcell(mi, MI_GC(mi), col, row);
 #if 0                          /* Can not see eyes */
        {
@@ -661,7 +712,7 @@ draw_anant(ModeInfo * mi, int col, int row)
 
                if (ap->xs > 2 && ap->ys > 2) {         /* Draw Eyes */
 
-                       XSetForeground(display, MI_GC(mi), MI_WIN_BLACK_PIXEL(mi));
+                       XSetForeground(display, MI_GC(mi), MI_BLACK_PIXEL(mi));
                        switch (direction) {
                                case 0:
                                        XDrawPoint(display, window, MI_GC(mi),
@@ -721,11 +772,11 @@ fromTableDirection(unsigned char dir, int neighbors)
                case TRS:
                        return (ANGLES / neighbors);
                case THRS:
-                       return (ANGLES / (2 * neighbors));
+                       return (ANGLES / 2 - ANGLES / neighbors);
                case TBS:
                        return (ANGLES / 2);
                case THLS:
-                       return (ANGLES - ANGLES / (2 * neighbors));
+                       return (ANGLES / 2 + ANGLES / neighbors);
                case TLS:
                        return (ANGLES - ANGLES / neighbors);
                case SF:
@@ -733,11 +784,11 @@ fromTableDirection(unsigned char dir, int neighbors)
                case STR:
                        return (ANGLES + ANGLES / neighbors);
                case STHR:
-                       return (ANGLES + ANGLES / (2 * neighbors));
+                       return (3 * ANGLES / 2 - ANGLES / neighbors);
                case STB:
                        return (3 * ANGLES / 2);
                case STHL:
-                       return (2 * ANGLES - ANGLES / (2 * neighbors));
+                       return (3 * ANGLES / 2 + ANGLES / neighbors);
                case STL:
                        return (2 * ANGLES - ANGLES / neighbors);
                default:
@@ -757,13 +808,47 @@ getTable(ModeInfo * mi, int i)
        ap->ncolors = *patptr++;
        ap->nstates = *patptr++;
        total = ap->ncolors * ap->nstates;
-       if (MI_WIN_IS_VERBOSE(mi))
+       if (MI_IS_VERBOSE(mi))
                (void) fprintf(stdout,
-                    "neighbors %d, table number %d, colors %d, states %d\n",
-                              ap->neighbors, i, ap->ncolors, ap->nstates);
+                              "ants %d, neighbors %d, table number %d, colors %d, states %d\n",
+                         ap->n, ap->neighbors, i, ap->ncolors, ap->nstates);
        for (j = 0; j < total; j++) {
                ap->machine[j].color = *patptr++;
-               ap->machine[j].direction = fromTableDirection(*patptr++, ap->neighbors);
+               if (ap->sharpturn && ap->neighbors > 4 && !(ap->neighbors % 2)) {
+                       int         k = *patptr++;
+
+                       switch (k) {
+                               case TRS:
+                                       k = THRS;
+                                       break;
+                               case THRS:
+                                       k = TRS;
+                                       break;
+                               case THLS:
+                                       k = TLS;
+                                       break;
+                               case TLS:
+                                       k = THLS;
+                                       break;
+                               case STR:
+                                       k = STHR;
+                                       break;
+                               case STHR:
+                                       k = STR;
+                                       break;
+                               case STHL:
+                                       k = STL;
+                                       break;
+                               case STL:
+                                       k = STHL;
+                                       break;
+                               default:
+                                       break;
+                       }
+                       ap->machine[j].direction = fromTableDirection(k, ap->neighbors);
+               } else {
+                       ap->machine[j].direction = fromTableDirection(*patptr++, ap->neighbors);
+               }
                ap->machine[j].next = *patptr++;
        }
        ap->truchet = False;
@@ -786,19 +871,24 @@ getTurk(ModeInfo * mi, int i)
        total = ap->ncolors * ap->nstates;
        for (j = 0; j < total; j++) {
                ap->machine[j].color = (j + 1) % total;
-               ap->machine[j].direction = (power2 & number) ?
-                       fromTableDirection(TRS, ap->neighbors) :
-                       fromTableDirection(TLS, ap->neighbors);
+               if (ap->sharpturn && ap->neighbors > 4 && !(ap->neighbors % 2)) {
+                       ap->machine[j].direction = (power2 & number) ?
+                               fromTableDirection(THRS, ap->neighbors) :
+                               fromTableDirection(THLS, ap->neighbors);
+               } else {
+                       ap->machine[j].direction = (power2 & number) ?
+                               fromTableDirection(TRS, ap->neighbors) :
+                               fromTableDirection(TLS, ap->neighbors);
+               }
                ap->machine[j].next = 0;
                power2 >>= 1;
        }
-       if (ap->neighbors != 3 && ap->neighbors != 4 && ap->neighbors != 6)
-               ap->truchet = False;
-       else if (truchet)
-               ap->truchet = True;
-       if (MI_WIN_IS_VERBOSE(mi))
-               (void) fprintf(stdout, "neighbors %d, Turk's number %d, colors %d\n",
-                              ap->neighbors, number, ap->ncolors);
+       ap->truchet = (ap->truchet && ap->xs > 2 && ap->ys > 2 &&
+          (ap->neighbors == 3 || ap->neighbors == 4 || ap->neighbors == 6));
+       if (MI_IS_VERBOSE(mi))
+               (void) fprintf(stdout,
+                     "ants %d, neighbors %d, Turk's number %d, colors %d\n",
+                              ap->n, ap->neighbors, number, ap->ncolors);
 }
 
 void
@@ -807,9 +897,9 @@ init_ant(ModeInfo * mi)
        Display    *display = MI_DISPLAY(mi);
        Window      window = MI_WINDOW(mi);
        int         size = MI_SIZE(mi);
-       XGCValues   gcv;
        antfarmstruct *ap;
-       int         col, row, i, dir;
+       int         col, row, dir;
+       long        i;
 
        /* jwz sez: small sizes look like crap */
        if (size < 0)
@@ -826,16 +916,18 @@ init_ant(ModeInfo * mi)
        ap->redrawing = 0;
        if (MI_NPIXELS(mi) <= 2) {
                if (ap->stippledGC == None) {
+                       XGCValues   gcv;
+
                        gcv.fill_style = FillOpaqueStippled;
                        ap->stippledGC = XCreateGC(display, window, GCFillStyle, &gcv);
                }
                if (ap->init_bits == 0) {
-                       for (i = 0; i < COLORS - 1; i++)
-                               ANTBITS(patterns[i], PATTERNSIZE, PATTERNSIZE);
+                       for (i = 1; i < NUMSTIPPLES; i++)
+                               ANTBITS(stipples[i], STIPPLESIZE, STIPPLESIZE);
                }
        }
        ap->generation = 0;
-       ap->n = MI_BATCHCOUNT(mi);
+       ap->n = MI_COUNT(mi);
        if (ap->n < -MINANTS) {
                /* if ap->n is random ... the size can change */
                if (ap->ants != NULL) {
@@ -846,19 +938,19 @@ init_ant(ModeInfo * mi)
        } else if (ap->n < MINANTS)
                ap->n = MINANTS;
 
-       ap->width = MI_WIN_WIDTH(mi);
-       ap->height = MI_WIN_HEIGHT(mi);
+       ap->width = MI_WIDTH(mi);
+       ap->height = MI_HEIGHT(mi);
 
        if (neighbors == 8 || neighbors == 9 || neighbors == 12)
                ap->neighbors = neighbors;      /* Discourage but not deny use... */
        else
                for (i = 0; i < NEIGHBORKINDS; i++) {
-                       if (neighbors == initVal[i]) {
-                               ap->neighbors = initVal[i];
+                       if (neighbors == plots[i]) {
+                               ap->neighbors = plots[i];
                                break;
                        }
                        if (i == NEIGHBORKINDS - 1) {
-                               ap->neighbors = initVal[NRAND(NEIGHBORKINDS)];
+                               ap->neighbors = plots[NRAND(NEIGHBORKINDS)];
                                break;
                        }
                }
@@ -870,10 +962,13 @@ init_ant(ModeInfo * mi)
                        ap->width = 2;
                if (ap->height < 4)
                        ap->height = 4;
-               if (size < -MINSIZE)
+               if (size < -MINSIZE) {
                        ap->ys = NRAND(MIN(-size, MAX(MINSIZE, MIN(ap->width, ap->height) /
                                      MINGRIDSIZE)) - MINSIZE + 1) + MINSIZE;
-               else if (size < MINSIZE) {
+                       if (ap->ys < MINRANDOMSIZE)
+                               ap->ys = MIN(MINRANDOMSIZE,
+                                            MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE));
+               } else if (size < MINSIZE) {
                        if (!size)
                                ap->ys = MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE);
                        else
@@ -888,15 +983,21 @@ init_ant(ModeInfo * mi)
                ap->nrows = 2 * (ncrows / 4);
                ap->xb = (ap->width - ap->xs * nccols) / 2 + ap->xs / 2;
                ap->yb = (ap->height - ap->ys * (ncrows / 2) * 2) / 2 + ap->ys;
-               for (i = 0; i < 7; i++) {
-                       ap->hexagonList[i].x = (ap->xs - 1) * hexagonUnit[i].x;
-                       ap->hexagonList[i].y = ((ap->ys - 1) * hexagonUnit[i].y / 2) * 4 / 3;
+               for (i = 0; i < 6; i++) {
+                       ap->shape.hexagon[i].x = (ap->xs - 1) * hexagonUnit[i].x;
+                       ap->shape.hexagon[i].y = ((ap->ys - 1) * hexagonUnit[i].y / 2) * 4 / 3;
                }
-       } else if (ap->neighbors == 4 && ap->neighbors == 8) {
-               if (size < -MINSIZE)
+               /* Avoid array bounds read of hexagonUnit */
+               ap->shape.hexagon[6].x = 0;
+               ap->shape.hexagon[6].y = 0;
+       } else if (ap->neighbors == 4 || ap->neighbors == 8) {
+               if (size < -MINSIZE) {
                        ap->ys = NRAND(MIN(-size, MAX(MINSIZE, MIN(ap->width, ap->height) /
                                      MINGRIDSIZE)) - MINSIZE + 1) + MINSIZE;
-               else if (size < MINSIZE) {
+                       if (ap->ys < MINRANDOMSIZE)
+                               ap->ys = MIN(MINRANDOMSIZE,
+                                            MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE));
+               } else if (size < MINSIZE) {
                        if (!size)
                                ap->ys = MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE);
                        else
@@ -916,10 +1017,13 @@ init_ant(ModeInfo * mi)
                        ap->width = 2;
                if (ap->height < 2)
                        ap->height = 2;
-               if (size < -MINSIZE)
+               if (size < -MINSIZE) {
                        ap->ys = NRAND(MIN(-size, MAX(MINSIZE, MIN(ap->width, ap->height) /
                                      MINGRIDSIZE)) - MINSIZE + 1) + MINSIZE;
-               else if (size < MINSIZE) {
+                       if (ap->ys < MINRANDOMSIZE)
+                               ap->ys = MIN(MINRANDOMSIZE,
+                                            MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE));
+               } else if (size < MINSIZE) {
                        if (!size)
                                ap->ys = MAX(MINSIZE, MIN(ap->width, ap->height) / MINGRIDSIZE);
                        else
@@ -933,24 +1037,37 @@ init_ant(ModeInfo * mi)
                ap->xb = (ap->width - ap->xs * ap->ncols) / 2 + ap->xs / 2;
                ap->yb = (ap->height - ap->ys * ap->nrows) / 2 + ap->ys;
                for (orient = 0; orient < 2; orient++) {
-                       for (i = 0; i < 4; i++) {
-                               ap->triangleList[orient][i].x =
+                       for (i = 0; i < 3; i++) {
+                               ap->shape.triangle[orient][i].x =
                                        (ap->xs - 2) * triangleUnit[orient][i].x;
-                               ap->triangleList[orient][i].y =
+                               ap->shape.triangle[orient][i].y =
                                        (ap->ys - 2) * triangleUnit[orient][i].y;
                        }
+                       /* Avoid array bounds read of triangleUnit */
+                       ap->shape.triangle[orient][3].x = 0;
+                       ap->shape.triangle[orient][3].y = 0;
                }
        }
-       XClearWindow(display, MI_WINDOW(mi));
 
+       XSetLineAttributes(display, MI_GC(mi), 1, LineSolid, CapNotLast, JoinMiter);
+       MI_CLEARWINDOW(mi);
+       ap->painted = False;
+
+       if (MI_IS_FULLRANDOM(mi)) {
+               ap->truchet = (Bool) (LRAND() & 1);
+               ap->sharpturn = (Bool) (LRAND() & 1);
+       } else {
+               ap->truchet = truchet;
+               ap->sharpturn = sharpturn;
+       }
        /* Exclude odd # of neighbors, stepping forward not defined */
-       if (!NRAND(COLORS) && ((ap->neighbors + 1) % 2)) {
+       if (!NRAND(NUMSTIPPLES) && ((ap->neighbors + 1) % 2)) {
                getTable(mi, (int) (NRAND(NTABLES)));
        } else
-               getTurk(mi, (int) (NRAND(COLORS - 1)));
+               getTurk(mi, (int) (NRAND(NUMSTIPPLES - 1)));
        if (MI_NPIXELS(mi) > 2)
                for (i = 0; i < (int) ap->ncolors - 1; i++)
-                       ap->colors[i] = (NRAND(MI_NPIXELS(mi)) +
+                       ap->colors[i] = (unsigned char) (NRAND(MI_NPIXELS(mi)) +
                             i * MI_NPIXELS(mi)) / ((int) (ap->ncolors - 1));
        if (ap->ants == NULL)
                ap->ants = (antstruct *) malloc(ap->n * sizeof (antstruct));
@@ -987,6 +1104,9 @@ draw_ant(ModeInfo * mi)
        unsigned char color;
        short       chg_dir, old_dir;
 
+       MI_IS_DRAWN(mi) = True;
+
+       ap->painted = True;
        for (i = 0; i < ap->n; i++) {
                anant = &ap->ants[i];
                tape_pos = anant->col + anant->row * ap->ncols;
@@ -1005,10 +1125,15 @@ draw_ant(ModeInfo * mi)
                        int         a = 0, b;
 
                        if (ap->neighbors == 6) {
-                               a = (old_dir / 60) % 3;
-                               b = (anant->direction / 60) % 3;
-                               a = (a + b + 1) % 3;
-                               drawtruchet(mi, anant->col, anant->row, status->color, a);
+                               if (ap->sharpturn) {
+                                       a = (chg_dir / 120 == 2);
+                                       drawtruchet(mi, anant->col, anant->row, status->color, a);
+                               } else {
+                                       a = (old_dir / 60) % 3;
+                                       b = (anant->direction / 60) % 3;
+                                       a = (a + b + 1) % 3;
+                                       drawtruchet(mi, anant->col, anant->row, status->color, a);
+                               }
                        } else if (ap->neighbors == 4) {
                                a = old_dir / 180;
                                b = anant->direction / 180;
@@ -1034,7 +1159,7 @@ draw_ant(ModeInfo * mi)
 #ifdef STANDALONE
          erase_full_window(MI_DISPLAY(mi), MI_WINDOW(mi));
 #endif
-         init_ant(mi);
+               init_ant(mi);
        }
        if (ap->redrawing) {
                for (i = 0; i < REDRAWSTEP; i++) {
@@ -1087,6 +1212,9 @@ refresh_ant(ModeInfo * mi)
 {
        antfarmstruct *ap = &antfarms[MI_SCREEN(mi)];
 
-       ap->redrawing = 1;
-       ap->redrawpos = 0;
+       if (ap->painted) {
+               MI_CLEARWINDOW(mi);
+               ap->redrawing = 1;
+               ap->redrawpos = 0;
+       }
 }
index 0cea509a40406b687b1c8b6a17cfdd80f945cd68..4b16af97b9b904d3201a2bd1ce5570065fd265e5 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 9f5e98f7908621c944e3108cdff62238aa3309a6..fabdc8a3b2e1ef7b9be165c2e9b5738e5bddd2a9 100644 (file)
@@ -173,6 +173,6 @@ permission notice appear in supporting documentation.  No representations are
 made about the suitability of this software for any purpose.  It is provided
 "as is" without express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
 
 Viscosity and mouse support by Philip Edward Cutone, III.
index 5b3cf8c14f4053a7738643eae0266ab2b6fd3bf6..cf2941b5484040a98c5a3e34906e552b0b65244a 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 9d8dc08e1702b1c4f3920691aaf4e4ae8af3eb75..f374666ee8b876a48fb79f1c9429d86ace79218e 100644 (file)
@@ -100,7 +100,7 @@ notice and this permission notice appear in supporting documentation.  No
 representations are made about the suitability of this software for any
 purpose.  It is provided "as is" without express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 17-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 17-aug-92.
 
 Based on SmallTalk code which appeared in the August 1981 issue of Byte
 magazine.
index 4f6e8ecbd2cc4fa839575ad9ee6fe6bab8616ccd..7e77e464bb10120d67b91b9b951e953723f1ede4 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 4 -*-
    Ported from xlockmore 4.03a12 to be a standalone program and thus usable
-   with xscreensaver by Jamie Zawinski <jwz@netscape.com> on 15-May-97.
+   with xscreensaver by Jamie Zawinski <jwz@jwz.org> on 15-May-97.
 
    Original copyright notice from xlock.c:
 
@@ -32,12 +32,12 @@ static const char sccsid[] = "@(#)bouboule.c        4.00 97/01/01 xlockmore";
  * I only scale the sort of sphere you see to the whole sky and clip the stars
  * to the camera screen.
  *
- *   Code Copyright 1996 by Jeremie PETIT (petit@eurecom.fr, jpetit@essi.fr)
+ *   Code Copyright 1996 by Jeremie PETIT (jeremie_petit@geocities.com)
  *
  *   Use: batchcount is the number of stars.
  *        cycles is the maximum size for a star
  *
- * 15-May-97: jwz@netscape.com: turned into a standalone program.
+ * 15-May-97: jwz@jwz.org: turned into a standalone program.
  * 04-Sep-96: Added 3d support (Henrik Theiling, theiling@coli-uni-sb.de)
  * 20-Feb-96: Added tests so that already malloced objects are not
  *            malloced twice, thanks to the report from <mccomb@interport.net>
index cdffed43baf608db86577a3a29ee01895973b783..b2a8df24d52d45e4248754f79032b0016e790a81 100644 (file)
@@ -73,4 +73,4 @@ VMS support by Jouk Jansen <joukj@alpha.chem.uva.nl>, 01-Feb-96.
 TrueColor support by David Bagley <bagleyd@bigfoot.com>, 01-Feb-96.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 15-May-97.
+Jamie Zawinski <jwz@jwz.org>, 15-May-97.
index 4bbd93a6d758977aa5a378d79d708bb0bd49ec11..9d9c4e5fd37d7191520da055279ae13f4e204f3e 100644 (file)
@@ -21,7 +21,7 @@ static const char sccsid[] = "@(#)braid.c     4.00 97/01/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 01-Sep-95: color knotted components differently, J. Neil.
  * 29-Aug-95: Written.  John Neil <neil@math.idbsu.edu>
  */
index 3310616d42b2150d6c228b7391def64550b76d1f..65637afe87f8bca7f50530bd7b9a7ddb32666973 100644 (file)
@@ -62,4 +62,4 @@ supporting documentation.
 John Neil <neil@math.idbsu.edu>, 29-Aug-95.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index e127ea1b8a0c9139876d334be34f4931a3f00b44..a3b0a9cc5b18a9237dd3dcd19c3f1a32698ea346 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -30,6 +30,7 @@
 # include "images/amiga.xpm"
 #endif
 
+#include "images/atari.xbm"
 #include "images/mac.xbm"
 
 
@@ -131,7 +132,7 @@ double_pixmap(Display *dpy, GC gc, Visual *visual, int depth, Pixmap pixmap,
   XImage *i1 = XGetImage(dpy, pixmap, 0, 0, pix_w, pix_h, ~0L, ZPixmap);
   XImage *i2 = XCreateImage(dpy, visual, depth, ZPixmap, 0, 0,
                            pix_w*2, pix_h*2, 8, 0);
-  i2->data = (unsigned char *) calloc(i2->height, i2->bytes_per_line);
+  i2->data = (char *) calloc(i2->height, i2->bytes_per_line);
   for (y = 0; y < pix_h; y++)
     for (x = 0; x < pix_w; x++)
       {
@@ -295,6 +296,146 @@ windows (Display *dpy, Window window, int delay, Bool w95p)
   XFreeFont(dpy, font);
 }
 
+/* SCO OpenServer 5 panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
+ */
+static void
+openserver (Display *dpy, Window window, int delay)
+{
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  char *fontname;
+  const char *def_font = "fixed";
+  XFontStruct *font;
+  GC gc;
+
+  const char *openserver_panic =
+    ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
+     "Unexpected trap in kernel mode:\n"
+     "\n"
+     "cr0 0x80010013     cr2  0x00000014     cr3 0x00000000  tlb  0x00000000\n"
+     "ss  0x00071054    uesp  0x00012055     efl 0x00080888  ipl  0x00000005\n"
+     "cs  0x00092585     eip  0x00544a4b     err 0x004d4a47  trap 0x0000000E\n"
+     "eax 0x0045474b     ecx  0x0042544b     edx 0x57687920  ebx  0x61726520\n"
+     "esp 0x796f7520     ebp  0x72656164     esi 0x696e6720  edi  0x74686973\n"
+     "ds  0x3f000000     es   0x43494c48     fs  0x43525343  gs   0x4f4d4b53\n"
+     "\n"
+     "PANIC: k_trap - kernel mode trap type 0x0000000E\n"
+     "Trying to dump 5023 pages to dumpdev hd (1/41), 63 pages per '.'\n"
+     "...............................................................................\n"
+     "5023 pages dumped\n"
+     "\n"
+     "\n"
+     "**   Safe to Power Off   **\n"
+     "           - or -\n"
+     "** Press Any Key to Reboot **\n"
+    );
+
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+
+  fontname = get_string_resource ((xgwa.height > 600
+                                  ? "openserver.font2"
+                                  : "openserver.font"),
+                                 "OpenServer.Font");
+  if (!fontname || !*fontname) fontname = (char *)def_font;
+  font = XLoadQueryFont (dpy, fontname);
+  if (!font) font = XLoadQueryFont (dpy, def_font);
+  if (!font) exit(-1);
+  if (fontname && fontname != def_font)
+    free (fontname);
+
+  gcv.font = font->fid;
+  gcv.foreground = get_pixel_resource(("openserver.foreground"),
+                                     "OpenServer.Foreground",
+                                     dpy, xgwa.colormap);
+  gcv.background = get_pixel_resource(("openserver.background"),
+                                     "OpenServer.Background",
+                                     dpy, xgwa.colormap);
+  XSetWindowBackground(dpy, window, gcv.background);
+  XClearWindow(dpy, window);
+
+  gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
+
+  draw_string(dpy, window, gc, &gcv, font,
+               0, 0, xgwa.width, xgwa.height, openserver_panic, 0);
+  XFreeGC(dpy, gc);
+  XSync(dpy, False);
+  bsod_sleep(dpy, delay);
+  XClearWindow(dpy, window);
+  XFreeFont(dpy, font);
+}
+
+
+/* Linux (sparc) panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
+ */
+static void
+sparc_linux (Display *dpy, Window window, int delay)
+{
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  char *fontname;
+  const char *def_font = "fixed";
+  XFontStruct *font;
+  GC gc;
+
+  const char *linux_panic =
+    ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
+       "Unable to handle kernel paging request at virtual address f0d4a000\n"
+       "tsk->mm->context = 00000014\n"
+       "tsk->mm->pgd = f26b0000\n"
+       "              \\|/ ____ \\|/\n"
+       "              \"@'/ ,. \\`@\"\n"
+       "              /_| \\__/ |_\\\n"
+       "                 \\__U_/\n"
+       "gawk(22827): Oops\n"
+       "PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000\n"
+       "g0: 00001000 g1: fffffff7 g2: 04401086 g3: 0001eaa0\n"
+       "g4: 000207dc g5: f0130400 g6: f0d4a018 g7: 00000001\n"
+       "o0: 00000000 o1: f0d4a298 o2: 00000040 o3: f1380718\n"
+       "o4: f1380718 o5: 00000200 sp: f1b13f08 ret_pc: f001c2a0\n"
+       "l0: efffd880 l1: 00000001 l2: f0d4a230 l3: 00000014\n"
+       "l4: 0000ffff l5: f0131550 l6: f012c000 l7: f0130400\n"
+       "i0: f1b13fb0 i1: 00000001 i2: 00000002 i3: 0007c000\n"
+       "i4: f01457c0 i5: 00000004 i6: f1b13f70 i7: f0015360\n"
+       "Instruction DUMP:"
+
+    );
+
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+
+  fontname = get_string_resource ((xgwa.height > 600
+                                  ? "sparclinux.font2"
+                                  : "sparclinux.font"),
+                                 "SparcLinux.Font");
+  if (!fontname || !*fontname) fontname = (char *)def_font;
+  font = XLoadQueryFont (dpy, fontname);
+  if (!font) font = XLoadQueryFont (dpy, def_font);
+  if (!font) exit(-1);
+  if (fontname && fontname != def_font)
+    free (fontname);
+
+  gcv.font = font->fid;
+  gcv.foreground = get_pixel_resource(("sparclinux.foreground"),
+                                     "SparcLinux.Foreground",
+                                     dpy, xgwa.colormap);
+  gcv.background = get_pixel_resource(("sparclinux.background"),
+                                     "SparcLinux.Background",
+                                     dpy, xgwa.colormap);
+  XSetWindowBackground(dpy, window, gcv.background);
+  XClearWindow(dpy, window);
+
+  gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
+
+  draw_string(dpy, window, gc, &gcv, font,
+               0, 0, xgwa.width, xgwa.height, linux_panic, 0);
+  XFreeGC(dpy, gc);
+  XSync(dpy, False);
+  bsod_sleep(dpy, delay);
+  XClearWindow(dpy, window);
+  XFreeFont(dpy, font);
+}
+
 static void
 amiga (Display *dpy, Window window, int delay)
 {
@@ -426,6 +567,77 @@ amiga (Display *dpy, Window window, int delay)
 }
 
 
+/* Atari ST, by Marcus Herbert <rhoenie@nobiscum.de>
+   Marcus had this to say:
+
+       Though I still have my Atari somewhere, I hardly remember
+       the meaning of the bombs. I think 9 bombs was "bus error" or
+       something like that.  And you often had a few bombs displayed
+       quickly and then the next few ones coming up step by step.
+       Perhaps somebody else can tell you more about it..  its just
+       a quick hack :-}
+ */
+static void
+atari (Display *dpy, Window window, int delay)
+{
+       
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  const char *def_font = "fixed";
+  XFontStruct *font;
+  GC gc;
+  Pixmap pixmap = 0;
+  int pix_w = atari_width;
+  int pix_h = atari_height;
+  int offset = atari_width + 2;
+  int i, x, y;
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+
+  font = XLoadQueryFont (dpy, def_font);
+  if (!font) exit(-1);
+                
+  gcv.font = font->fid;
+  gcv.foreground = get_pixel_resource("atari.foreground", "Atari.Foreground",
+                                     dpy, xgwa.colormap);
+  gcv.background = get_pixel_resource("atari.background", "Atari.Background",
+                                     dpy, xgwa.colormap);
+
+  XSetWindowBackground(dpy, window, gcv.background);
+  XClearWindow(dpy, window);
+
+  gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
+
+  pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) atari_bits,
+                                      atari_width, atari_height,
+                                      gcv.foreground,
+                                      gcv.background,
+                                      xgwa.depth);
+
+  x = 5;
+  y = (xgwa.height - (xgwa.height / 5));
+  if (y < 0) y = 0;
+
+  for (i=0 ; i<7 ; i++) {
+    XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
+             (x + (i*offset)), y);
+  }  
+  
+  for (i=7 ; i<10 ; i++) {
+    bsod_sleep(dpy, 1);
+    XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
+             (x + (i*offset)), y);
+  }
+
+  XFreePixmap(dpy, pixmap);
+  XFreeGC(dpy, gc);
+  XSync(dpy, False);
+  bsod_sleep(dpy, delay);
+  XClearWindow(dpy, window);
+  XFreeFont(dpy, font);
+}
+
+
 static void
 mac (Display *dpy, Window window, int delay)
 {
@@ -565,11 +777,46 @@ macsbug (Display *dpy, Window window, int delay)
                        "                                | 4A1F\n"
                        "     +00888    40843718     $0004(A7),([0,A7[)"
                        "                  ; 04E8D0AE    | 66B8");
+
+#if 0
   const char *body = ("Bus Error at 4BF6D6CC\n"
                      "while reading word from 4BF6D6CC in User data space\n"
                      " Unable to access that address\n"
                      "  PC: 2A0DE3E6\n"
                      "  Frame Type: B008");
+#else
+  const char * body = ("PowerPC unmapped memory exception at 003AFDAC "
+                                               "BowelsOfTheMemoryMgr+04F9C\n"
+                     " Calling chain using A6/R1 links\n"
+                     "  Back chain  ISA  Caller\n"
+                     "  00000000    PPC  28C5353C  __start+00054\n"
+                     "  24DB03C0    PPC  28B9258C  main+0039C\n"
+                     "  24DB0350    PPC  28B9210C  MainEvent+00494\n"
+                     "  24DB02B0    PPC  28B91B40  HandleEvent+00278\n"
+                     "  24DB0250    PPC  28B83DAC  DoAppleEvent+00020\n"
+                     "  24DB0210    PPC  FFD3E5D0  "
+                                               "AEProcessAppleEvent+00020\n"
+                     "  24DB0132    68K  00589468\n"
+                     "  24DAFF8C    68K  00589582\n"
+                     "  24DAFF26    68K  00588F70\n"
+                     "  24DAFEB3    PPC  00307098  "
+                                               "EmToNatEndMoveParams+00014\n"
+                     "  24DAFE40    PPC  28B9D0B0  DoScript+001C4\n"
+                     "  24DAFDD0    PPC  28B9C35C  RunScript+00390\n"
+                     "  24DAFC60    PPC  28BA36D4  run_perl+000E0\n"
+                     "  24DAFC10    PPC  28BC2904  perl_run+002CC\n"
+                     "  24DAFA80    PPC  28C18490  Perl_runops+00068\n"
+                     "  24DAFA30    PPC  28BE6CC0  Perl_pp_backtick+000FC\n"
+                     "  24DAF9D0    PPC  28BA48B8  Perl_my_popen+00158\n"
+                     "  24DAF980    PPC  28C5395C  sfclose+00378\n"
+                     "  24DAF930    PPC  28BA568C  free+0000C\n"
+                     "  24DAF8F0    PPC  28BA6254  pool_free+001D0\n"
+                     "  24DAF8A0    PPC  FFD48F14  DisposePtr+00028\n"
+                     "  24DAF7C9    PPC  00307098  "
+                                               "EmToNatEndMoveParams+00014\n"
+                     "  24DAF780    PPC  003AA180  __DisposePtr+00010");
+#endif
+
   const char *s;
   int body_lines = 1;
 
@@ -638,8 +885,6 @@ macsbug (Display *dpy, Window window, int delay)
   draw_string(dpy, window, gc, &gcv, font, xoff, yoff, 10, 10, left, 0);
   draw_string(dpy, window, gc, &gcv, font, xoff+col_right, yoff+row_top,
              10, 10, bottom, 0);
-  draw_string(dpy, window, gc, &gcv, font,
-             xoff + col_right + char_width, yoff + body_top, 10, 10, body, 0);
 
   XFillRectangle(dpy, window, gc, xoff + col_right, yoff, 2, page_bottom);
   XDrawLine(dpy, window, gc,
@@ -648,6 +893,13 @@ macsbug (Display *dpy, Window window, int delay)
            xoff+col_right, yoff+row_bottom, xoff+page_right, yoff+row_bottom);
   XDrawRectangle(dpy, window, gc,  xoff, yoff, page_right, page_bottom);
 
+  if (body_top > 4)
+    body_top = 4;
+
+  draw_string(dpy, window, gc, &gcv, font,
+             xoff + col_right + char_width, yoff + body_top, 10, 10, body,
+             500);
+
   while (delay > 0)
     {
       XDrawLine(dpy, window, gc,
@@ -693,12 +945,25 @@ char *defaults [] = {
   ".Mac.foreground:     PaleTurquoise1",
   ".Mac.background:     Black",
 
+  ".Atari.foreground:   Black",
+  ".Atari.background:   White",
+
   ".MacsBug.font:       -*-courier-medium-r-*-*-*-100-*-*-m-*-*-*",
   ".MacsBug.font2:      -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
   ".MacsBug.font3:      -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
   ".MacsBug.foreground:         Black",
   ".MacsBug.background:         White",
   ".MacsBug.borderColor: #AAAAAA",
+  
+  ".OpenServer.font:    -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
+  ".OpenServer.font2:   -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
+  ".OpenServer.foreground: White",
+  ".OpenServer.background: Black",
+  
+  ".SparcLinux.font:    -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
+  ".SparcLinux.font2:   -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
+  ".SparcLinux.foreground: White",
+  ".SparcLinux.background: Black",
   0
 };
 
@@ -720,7 +985,7 @@ screenhack (Display *dpy, Window window)
 
   while (1)
     {
-      while (i == j) i = random() % 5;
+      while (i == j) i = random() % 8;
       j = i;
 
       switch (i)
@@ -730,6 +995,9 @@ screenhack (Display *dpy, Window window)
        case 2: amiga(dpy, window, delay); break;
        case 3: mac(dpy, window, delay); break;
        case 4: macsbug(dpy, window, delay); break;
+       case 5: openserver(dpy, window, delay); break;
+       case 6: sparc_linux(dpy, window, delay); break;
+       case 7: atari(dpy, window, delay); break;
        default: abort(); break;
        }
       XSync (dpy, True);
index 8f9058e6b3b0cff5185f219cc350f76f28b52a64..f393f1fa5ec384af499fc1a9eac5434fd8419d33 100644 (file)
@@ -1,5 +1,5 @@
 /* bubbles_default.c - pick images for bubbles.c
- * By Jamie Zawinski <jwz@netscape.com>, 20-Jan-98.
+ * By Jamie Zawinski <jwz@jwz.org>, 20-Jan-98.
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 8ace44d2c1e6787baa00bdca88b0448b4facf269..55186747327297fbe731753507d061b0c3815064 100644 (file)
@@ -21,12 +21,12 @@ static int ncolors = 0;
 static int colorindex = 0;
 static int colorsloth;
 
-static XPoint *walkers;
+static XPoint *walkers = 0;
 static int nwalkers;
 static int width, widthb;
 static int height;
 
-static unsigned int *board;
+static unsigned int *board = 0;
 #define getdot(x,y) (board[(y*widthb)+(x>>5)] &  (1<<(x & 31)))
 #define setdot(x,y) (board[(y*widthb)+(x>>5)] |= (1<<(x & 31)))
 
@@ -47,6 +47,7 @@ init_coral(Display *dpy, Window window)
     width = xgwa.width;
     widthb = ((xgwa.width + 31) >> 5);
     height = xgwa.height;
+    if (board) free(board);
     board = (unsigned int *)calloc(widthb * xgwa.height, sizeof(unsigned int));
     if(!board) exit(1);
     cmap = xgwa.colormap;
@@ -73,6 +74,7 @@ init_coral(Display *dpy, Window window)
     if( density < 1 ) density = 1;
     if( density > 100 ) density = 90; /* more like mold than coral */
     nwalkers = (width*height*density)/100;
+    if (walkers) free(walkers);
     walkers = (XPoint *)calloc(nwalkers, sizeof(XPoint));
     if( (XPoint *)0 == walkers ) exit(1);
 
index caab2a894a4849dd8e52ddf0313a0dc161e1891f..4c4d5fbe61707bd8d44c9e00b1801c3c82560917 100644 (file)
@@ -2,7 +2,7 @@
 /* crystal --- polygons moving according to plane group rules */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)crystal.c    4.07 97/11/24 xlockmore";
+static const char sccsid[] = "@(#)crystal.c    4.12 98/09/10 xlockmore";
 
 #endif
 
@@ -28,6 +28,7 @@ static const char sccsid[] = "@(#)crystal.c   4.07 97/11/24 xlockmore";
  * A moving polygon-mode. The polygons obey 2D-planegroup symmetry.
  *
  * Revision History:
+ * 10-Sep-98: new colour scheme
  * 24-Feb-98: added option centre which turns on/off forcing the centre of
  *              the screen to be used
  *            added option maxsize which forces the dimensions to be chasen
@@ -35,7 +36,7 @@ static const char sccsid[] = "@(#)crystal.c   4.07 97/11/24 xlockmore";
  *              used 
  *            When only one unit cell is drawn, it is chosen at random
  * 18-Feb-98: added support for negative numbers with -nx and -ny meaning
- *            "random" choice with geiven maximum
+ *            "random" choice with given maximum
  *            added +/-grid option. If -cell is specified this option
  *            determines if one or all unit cells are drawn.
  *            -batchcount is now a parameter for all the objects on the screen
@@ -70,7 +71,7 @@ static const char sccsid[] = "@(#)crystal.c   4.07 97/11/24 xlockmore";
                                                 "*count:                -500   \n" \
                                                 "*cycles:                200   \n" \
                                                 "*size:                  -15   \n" \
-                                                "*ncolors:               200   \n" \
+                                                "*ncolors:               100   \n" \
                                                 "*fullrandom:   True   \n" \
                                                 "*verbose:             False   \n"
 # include "xlockmore.h"                /* in xscreensaver distribution */
@@ -86,12 +87,15 @@ static const char sccsid[] = "@(#)crystal.c 4.07 97/11/24 xlockmore";
 #define DEF_NY1 1              /* number of unit cells in y-direction */
 #define DEF_CENTRE "False"
 #define DEF_MAXSIZE "False"
+#define DEF_CYCLE "True"
 
 #define min(a,b) ((a) <= (b) ? (a) : (b))
 
+void release_crystal(ModeInfo * mi);
+
 static int  nx, ny;
 
-static Bool unit_cell, grid_cell, centre, maxsize;
+static Bool unit_cell, grid_cell, centre, maxsize, cycle_p;
 
 static XrmOptionDescRec opts[] =
 {
@@ -104,7 +108,9 @@ static XrmOptionDescRec opts[] =
        {"-cell", ".crystal.cell", XrmoptionNoArg, (caddr_t) "on"},
        {"+cell", ".crystal.cell", XrmoptionNoArg, (caddr_t) "off"},
        {"-grid", ".crystal.grid", XrmoptionNoArg, (caddr_t) "on"},
-       {"+grid", ".crystal.grid", XrmoptionNoArg, (caddr_t) "off"}
+       {"+grid", ".crystal.grid", XrmoptionNoArg, (caddr_t) "off"},
+       {"-shift", ".crystal.shift", XrmoptionNoArg, (caddr_t) "on"},
+       {"+shift", ".crystal.shift", XrmoptionNoArg, (caddr_t) "off"}
 };
 
 static argtype vars[] =
@@ -114,16 +120,18 @@ static argtype vars[] =
        {(caddr_t *) & centre, "centre", "Centre", DEF_CENTRE, t_Bool},
        {(caddr_t *) & maxsize, "maxsize", "Maxsize", DEF_MAXSIZE, t_Bool},
        {(caddr_t *) & unit_cell, "cell", "Cell", DEF_CELL, t_Bool},
-       {(caddr_t *) & grid_cell, "grid", "Grid", DEF_GRID, t_Bool}
+       {(caddr_t *) & grid_cell, "grid", "Grid", DEF_GRID, t_Bool},
+       {(caddr_t *) & cycle_p, "shift", "Shift", DEF_CYCLE, t_Bool}
 };
 static OptionStruct desc[] =
 {
        {"-nx num", "Number of unit cells in x-direction"},
        {"-ny num", "Number of unit cells in y-direction"},
-       {"-/+centre", "turn on/off cenetering on screen"},
+       {"-/+centre", "turn on/off centering on screen"},
        {"-/+maxsize", "turn on/off use of maximum part of screen"},
        {"-/+cell", "turn on/off drawing of unit cell"},
-    {"-/+grid", "turn on/off drawing of grid of unit cells (if -cell is on)"}
+   {"-/+grid", "turn on/off drawing of grid of unit cells (if -cell is on)"},
+       {"-/+shift", "turn on/off colour cycling"}
 };
 
 ModeSpecOpt crystal_opts =
@@ -246,6 +254,12 @@ typedef struct {
        crystalatom *atom;
        GC          gc;
        Bool        unit_cell, grid_cell;
+       Colormap    cmap;
+       XColor     *colors;
+       int         ncolors;
+       Bool        cycle_p, mono_p, no_colors;
+       unsigned long blackpixel, whitepixel, fg, bg;
+       int         direction;
 } crystalstruct;
 
 static crystalstruct *crystals = NULL;
@@ -527,13 +541,27 @@ draw_crystal(ModeInfo * mi)
        crystalstruct *cryst = &crystals[MI_SCREEN(mi)];
        int         i;
 
+       if (cryst->no_colors) {
+               release_crystal(mi);
+               init_crystal(mi);
+               return;
+       }
        cryst->painted = True;
+       MI_IS_DRAWN(mi) = True;
        XSetFunction(display, cryst->gc, GXxor);
+
+/* Rotate colours */
+       if (cryst->cycle_p) {
+               rotate_colors(display, cryst->cmap, cryst->colors, cryst->ncolors,
+                             cryst->direction);
+               if (!(LRAND() % 1000))
+                       cryst->direction = -cryst->direction;
+       }
        for (i = 0; i < cryst->num_atom; i++) {
                crystalatom *atom0;
 
                atom0 = &cryst->atom[i];
-               XSetForeground(display, cryst->gc, atom0->colour);
+               XSetForeground(display, cryst->gc, cryst->colors[atom0->colour].pixel);
                crystal_drawatom(mi, atom0);
                atom0->velocity[0] += NRAND(3) - 1;
                atom0->velocity[0] = MAX(-20, MIN(20, atom0->velocity[0]));
@@ -640,7 +668,7 @@ refresh_crystal(ModeInfo * mi)
                crystalatom *atom0;
 
                atom0 = &cryst->atom[i];
-               XSetForeground(display, cryst->gc, atom0->colour);
+               XSetForeground(display, cryst->gc, cryst->colors[atom0->colour].pixel);
                crystal_drawatom(mi, atom0);
        }
        XSetFunction(display, cryst->gc, GXcopy);
@@ -657,6 +685,17 @@ release_crystal(ModeInfo * mi)
                for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
                        crystalstruct *cryst = &crystals[screen];
 
+                       MI_WHITE_PIXEL(mi) = cryst->whitepixel;
+                       MI_BLACK_PIXEL(mi) = cryst->blackpixel;
+#ifndef STANDALONE
+                       MI_FG_PIXEL(mi) = cryst->fg;
+                       MI_BG_PIXEL(mi) = cryst->bg;
+#endif
+                       if (cryst->colors && cryst->ncolors && !cryst->no_colors)
+                               free_colors(display, cryst->cmap, cryst->colors, cryst->ncolors);
+                       if (cryst->colors)
+                               (void) free((void *) cryst->colors);
+                       XFreeColormap(display, cryst->cmap);
                        if (cryst->gc != NULL)
                                XFreeGC(display, cryst->gc);
                        if (cryst->atom != NULL)
@@ -687,6 +726,42 @@ init_crystal(ModeInfo * mi)
        cryst = &crystals[MI_SCREEN(mi)];
 
        if (!cryst->gc) {
+#ifndef STANDALONE
+               XColor      color;
+
+               extern char *background;
+               extern char *foreground;
+
+               cryst->fg = MI_FG_PIXEL(mi);
+               cryst->bg = MI_BG_PIXEL(mi);
+#endif
+               cryst->blackpixel = MI_BLACK_PIXEL(mi);
+               cryst->whitepixel = MI_WHITE_PIXEL(mi);
+
+#ifdef STANDALONE
+               cryst->cmap = mi->xgwa.colormap;
+#else /* !STANDALONE */
+               cryst->cmap = XCreateColormap(display, window,
+                                             MI_VISUAL(mi), AllocNone);
+               XSetWindowColormap(display, window, cryst->cmap);
+
+               (void) XParseColor(display, cryst->cmap, "black", &color);
+               (void) XAllocColor(display, cryst->cmap, &color);
+               MI_BLACK_PIXEL(mi) = color.pixel;
+               (void) XParseColor(display, cryst->cmap, "white", &color);
+               (void) XAllocColor(display, cryst->cmap, &color);
+               MI_WHITE_PIXEL(mi) = color.pixel;
+
+               (void) XParseColor(display, cryst->cmap, background, &color);
+               (void) XAllocColor(display, cryst->cmap, &color);
+               MI_BG_PIXEL(mi) = color.pixel;
+               (void) XParseColor(display, cryst->cmap, foreground, &color);
+               (void) XAllocColor(display, cryst->cmap, &color);
+               MI_FG_PIXEL(mi) = color.pixel;
+#endif /* !STANDALONE */
+
+               cryst->colors = 0;
+               cryst->ncolors = 0;
                if ((cryst->gc = XCreateGC(display, MI_WINDOW(mi),
                             (unsigned long) 0, (XGCValues *) NULL)) == None)
                        return;
@@ -696,7 +771,9 @@ init_crystal(ModeInfo * mi)
        cryst->painted = False;
        XSetFunction(display, cryst->gc, GXxor);
 
+
 /*Set up crystal data */
+       cryst->direction = (LRAND() & 1) ? 1 : -1;
        if (MI_IS_FULLRANDOM(mi)) {
                if (LRAND() & 1)
                        cryst->unit_cell = True;
@@ -811,7 +888,7 @@ init_crystal(ModeInfo * mi)
                        if (cryst->gamma > 90.0) {
                                if (cryst->offset_w > 0)
                                        cryst->offset_w = NRAND(cryst->offset_w) +
-                                               cryst->b * sin((cryst->gamma - 90) * PI_RAD);
+                                               (int) (cryst->b * sin((cryst->gamma - 90) * PI_RAD));
                                else
                                        cryst->offset_w = (int) (cryst->b * sin((cryst->gamma - 90) *
                                                                    PI_RAD));
@@ -896,15 +973,105 @@ init_crystal(ModeInfo * mi)
                                  (int) ((iny + 1) * cryst->b * cos((cryst->gamma - 90) * PI_RAD)) + cryst->offset_h);
                }
        }
+/* Set up colour map */
+       if (cryst->colors && cryst->ncolors && !cryst->no_colors)
+               free_colors(display, cryst->cmap, cryst->colors, cryst->ncolors);
+       if (cryst->colors)
+               (void) free((void *) cryst->colors);
+       cryst->colors = 0;
+#ifdef STANDALONE
+       cryst->ncolors = get_integer_resource("ncolors", "Integer");
+#else
+       cryst->ncolors = MI_NCOLORS(mi);
+#endif
+       if (cryst->ncolors < 2)
+               cryst->ncolors = 2;
+       if (cryst->ncolors <= 2)
+               cryst->mono_p = True;
+       else
+               cryst->mono_p = False;
+
+       if (cryst->mono_p)
+               cryst->colors = 0;
+       else
+               cryst->colors = (XColor *) malloc(sizeof (*cryst->colors) * (cryst->ncolors + 1));
+#ifdef STANDALONE
+       cryst->cycle_p = has_writable_cells(mi->xgwa.screen, mi->xgwa.visual);
+#else
+       cryst->cycle_p = has_writable_cells(mi);
+#endif
+       if (cryst->cycle_p) {
+               if (MI_IS_FULLRANDOM(mi)) {
+                       if (NRAND(8) == 7)
+                               cryst->cycle_p = False;
+                       else
+                               cryst->cycle_p = True;
+               } else {
+                       cryst->cycle_p = cycle_p;
+               }
+       }
+       if (!cryst->mono_p) {
+               if (!(LRAND() % 10))
+                       make_random_colormap(
+#ifdef STANDALONE
+                                                                mi->dpy, mi->xgwa.visual,
+#else
+                                                                mi,
+#endif
+                                                                cryst->cmap, cryst->colors, &cryst->ncolors,
+                                                                True, True, &cryst->cycle_p
+#ifdef STANDALONE
+                                                                , False
+#endif
+                                                                );
+               else if (!(LRAND() % 2))
+                       make_uniform_colormap(
+#ifdef STANDALONE
+                                                                 mi->dpy, mi->xgwa.visual,
+#else
+                                                                mi,
+#endif
+                                                                 cryst->cmap, cryst->colors, &cryst->ncolors,
+                                                                 True, &cryst->cycle_p
+#ifdef STANDALONE
+                                                                , False
+#endif
+                                                                );
+               else
+                       make_smooth_colormap(
+#ifdef STANDALONE
+                                                                mi->dpy, mi->xgwa.visual,
+#else
+                                                                mi,
+#endif
+                                                                cryst->cmap, cryst->colors, &cryst->ncolors,
+                                                                True, &cryst->cycle_p
+#ifdef STANDALONE
+                                                                , False
+#endif
+                                                                );
+       }
+       XInstallColormap(display, cryst->cmap);
+       if (cryst->ncolors < 2) {
+               cryst->ncolors = 2;
+               cryst->no_colors = True;
+       } else
+               cryst->no_colors = False;
+       if (cryst->ncolors <= 2)
+               cryst->mono_p = True;
+
+       if (cryst->mono_p)
+               cryst->cycle_p = False;
+
        for (i = 0; i < cryst->num_atom; i++) {
                crystalatom *atom0;
 
                atom0 = &cryst->atom[i];
-               if (MI_NPIXELS(mi) > 2)
-                       atom0->colour = MI_PIXEL(mi, NRAND(MI_NPIXELS(mi)));
+               if (cryst->ncolors > 2)
+                       atom0->colour = NRAND(cryst->ncolors - 2) + 2;
                else
                        atom0->colour = 1;      /*Xor'red so WHITE may not be appropriate */
-               XSetForeground(display, cryst->gc, atom0->colour);
+               XSetForeground(display, cryst->gc, cryst->colors[atom0->colour].pixel);
                atom0->x0 = NRAND(cryst->a);
                atom0->y0 = NRAND(cryst->b);
                atom0->velocity[0] = NRAND(7) - 3;
@@ -926,5 +1093,6 @@ init_crystal(ModeInfo * mi)
                crystal_setupatom(atom0, cryst->gamma);
                crystal_drawatom(mi, atom0);
        }
+       XSync(display, False);
        XSetFunction(display, cryst->gc, GXcopy);
 }
index 7d41e7a269666f4b62228d25f8e6c3bd1c038add..568825803ec0d71f114cad10131291a31c26604b 100644 (file)
@@ -1,7 +1,7 @@
 /* cynosure --- draw some rectangles
  *
  * 01-aug-96: written in Java by ozymandias G desiderata <ogd@organic.com>
- * 25-dec-97: ported to C and XScreenSaver by Jamie Zawinski <jwz@netscape.com>
+ * 25-dec-97: ported to C and XScreenSaver by Jamie Zawinski <jwz@jwz.org>
  *
  * Original version:
  *   http://www.organic.com/staff/ogd/java/cynosure.html
index ebcecfbcc1ee3e0aaf73c8aa4ae753fac0b93640..7b91f63bbd52b0cc06a25f6fcf68e39b724b96f6 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997 
- * Jamie Zawinski <jwz@netscape.com>
+ * Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 4479c6408d8cde518f2815e34dd9051621348d2a..3b49c09a74be7afb589cebaf42908c2b7c459cbc 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index e9f61c54e5510b22fee13195871eed267089237f..5f8a6fc71a06a0dbe6a319a3d1cc7265574931f0 100644 (file)
@@ -68,5 +68,5 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 26-Apr-97, based on code by
+Jamie Zawinski <jwz@jwz.org>, 26-Apr-97, based on code by
 Michael D. Bayne <mdb@go2net.com>.
index a26dfbb27aac09aa325a1fd0daaa6c01adc4b504..a18df51bc598dd5948957b6fa4538b8ce8543293 100644 (file)
@@ -1,5 +1,6 @@
-/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997, 1998
- * Jamie Zawinski <jwz@netscape.com>
+/* -*- mode: C; tab-width: 4 -*-
+ * xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997, 1998
+ * Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
  */
 
 /* distort
- * by Jonas Munsin (jmunsin@iki.fi)
- * it's a bit of a resource hog at the moment
+ * by Jonas Munsin (jmunsin@iki.fi) and Jamie Zawinski <jwz@jwz.org>
  * TODO:
- *     -optimize for speed
- *     -mutiple spheres/lenses (with bounces/layering)
- *     -different distortion matrices
- *     -randomize movement a bit
+ *     -check the allocations in init_round_lense again, maybe make it possible again
+ *      to use swamp without pre-allocating/calculating (although that
+ *      makes it slower) - -swamp is memory hungry
+ *     -more distortion matrices (fortunately, I'm out of ideas :)
+ * Stuff that would be cool but probably too much of a resource hog:
+ *     -some kind of interpolation to avoid jaggies
  * program idea borrowed from a screensaver on a non-*NIX OS,
- * code based on decayscreen by Jamie Zawinski
  */
 
 #include <math.h>
 #include "screenhack.h"
+#include <X11/Xutil.h>
 
-static int delay, radius, speed, size_x, size_y;
+#ifdef HAVE_XSHM_EXTENSION
+# include "xshm.h"
+static Bool use_shm;
+static XShmSegmentInfo shm_info;
+#endif /* HAVE_XSHM_EXTENSION */
+
+struct coo {
+       int x;
+       int y;
+       int r, r_change;
+       int xmove, ymove;
+};
+static struct coo xy_coo[10];
+
+static int delay, radius, speed, number, blackhole, vortex, magnify;
 static XWindowAttributes xgwa;
 static GC gc;
-static Pixmap orig_map, buffer_map;
+static Window g_window;
+static Display *g_dpy; 
+
+static XImage *orig_map, *buffer_map;
 
 static int ***from;
+static int ****from_array;
+static void (*effect) (int) = NULL;
+static void move_lense(int);
+static void swamp_thing(int);
+static void new_rnd_coo(int);
+static void init_round_lense(void);
 
-static void init_distort (Display *dpy, Window window) {
+static void init_distort(Display *dpy, Window window) 
+{
        XGCValues gcv;
        long gcflags;
-       int i, j;
-    
+       int i;
+
+       g_window=window;
+       g_dpy=dpy;
+
        delay = get_integer_resource ("delay", "Integer");
        radius = get_integer_resource ("radius", "Integer");
        speed = get_integer_resource ("speed", "Integer");
+       number = get_integer_resource ("number", "Integer");
+
+#ifdef HAVE_XSHM_EXTENSION
+       use_shm = get_boolean_resource("useSHM", "Boolean");
+#endif /* HAVE_XSHM_EXTENSION */
+       
+       blackhole = get_boolean_resource("blackhole", "Boolean");
+       vortex = get_boolean_resource("vortex", "Boolean");
+       magnify = get_boolean_resource("magnify", "Boolean");
+       
+       if (get_boolean_resource ("swamp", "Boolean"))
+               effect = &swamp_thing;
+       if (get_boolean_resource ("bounce", "Boolean"))
+               effect = &move_lense;
+
+       if (effect == NULL && radius == 0 && speed == 0 && number == 0
+               && !blackhole && !vortex && !magnify) {
+/* if no cmdline options are given, randomly choose one of:
+ * -radius 50 -number 4 -speed 1 -bounce
+ * -radius 50 -number 4 -speed 1 -blackhole
+ * -radius 50 -number 4 -speed 1 -vortex
+ * -radius 50 -number 4 -speed 1 -vortex -magnify
+ * -radius 50 -number 4 -speed 1 -vortex -magnify -blackhole
+ * -radius 100 -number 1 -speed 2 -bounce
+ * -radius 100 -number 1 -speed 2 -blackhole
+ * -radius 100 -number 1 -speed 2 -vortex
+ * -radius 100 -number 1 -speed 2 -vortex -magnify
+ * -radius 100 -number 1 -speed 2 -vortex -magnify -blackhole
+ * -radius 50 -number 4 -speed 2 -swamp
+ * -radius 50 -number 4 -speed 2 -swamp -blackhole
+ * -radius 50 -number 4 -speed 2 -swamp -vortex
+ * -radius 50 -number 4 -speed 2 -swamp -vortex -magnify
+ * -radius 50 -number 4 -speed 2 -swamp -vortex -magnify -blackhole
+ */
+               
+               i = (random() % 15);
+
+               switch (i) {
+                       case 0:
+                               radius=50;number=4;speed=1;
+                               effect=&move_lense;break;
+                       case 1:
+                               radius=50;number=4;speed=1;blackhole=1;
+                               effect=&move_lense;break;
+                       case 2:
+                               radius=50;number=4;speed=1;vortex=1;
+                               effect=&move_lense;break;
+                       case 3:
+                               radius=50;number=4;speed=1;vortex=1;magnify=1;
+                               effect=&move_lense;break;
+                       case 4:
+                               radius=50;number=4;speed=1;vortex=1;magnify=1;blackhole=1;
+                               effect=&move_lense;break;
+                       case 5:
+                               radius=100;number=1;speed=2;
+                               effect=&move_lense;break;
+                       case 6:
+                               radius=100;number=1;speed=2;blackhole=1;
+                               effect=&move_lense;break;
+                       case 7:
+                               radius=100;number=1;speed=2;vortex=1;
+                               effect=&move_lense;break;
+                       case 8:
+                               radius=100;number=1;speed=2;vortex=1;magnify=1;
+                               effect=&move_lense;break;
+                       case 9:
+                               radius=100;number=1;speed=2;vortex=1;magnify=1;blackhole=1;
+                               effect=&move_lense;break;
+                       case 10:
+                               radius=50;number=4;speed=2;
+                               effect=&swamp_thing;break;
+                       case 11:
+                               radius=50;number=4;speed=2;blackhole=1;
+                               effect=&swamp_thing;break;
+                       case 12:
+                               radius=50;number=4;speed=2;vortex=1;
+                               effect=&swamp_thing;break;
+                       case 13:
+                               radius=50;number=4;speed=2;vortex=1;magnify=1;
+                               effect=&swamp_thing;break;
+                       case 14: default:
+                               radius=50;number=4;speed=2;vortex=1;magnify=1;blackhole=1;
+                               effect=&swamp_thing;break;
+               }
+
+       }
 
        if (delay < 0)
                delay = 0;
        if (radius <= 0)
                radius = 60;
-       if (speed == 0) 
+       if (speed <= 0) 
                speed = 2;
+       if (number <= 0)
+               number=1;
+       if (number >= 10)
+               number=1;
+       if (effect == NULL)
+               effect = &move_lense;
 
        XGetWindowAttributes (dpy, window, &xgwa);
 
@@ -57,116 +178,281 @@ static void init_distort (Display *dpy, Window window) {
                gcflags |= GCSubwindowMode;
        gc = XCreateGC (dpy, window, gcflags, &gcv);
 
-       size_x = xgwa.width;
-       size_y = xgwa.height;
-    
        grab_screen_image (xgwa.screen, window);
 
-       orig_map = XCreatePixmap(dpy, window,
-                       xgwa.width, xgwa.height, xgwa.depth);
-       XCopyArea(dpy, window,
-                       orig_map, gc, 0, 0, xgwa.width, xgwa.height, 0, 0);
-       buffer_map = XCreatePixmap(dpy, window,
-                       2*radius + speed, 2*radius + speed,
-                       xgwa.depth);
-
-       from = (int ***)malloc ((2*radius+1) * sizeof(int **));
-       for(i = 0; i <= 2*radius; i++) {
-               from[i] = (int **)malloc((2*radius+1) * sizeof(int *));
-               for (j = 0; j <= 2*radius; j++)
-                       from[i][j] = (int *)malloc(2*sizeof(int));
+       buffer_map = 0;
+       orig_map = XGetImage(dpy, window, 0, 0, xgwa.width, xgwa.height,
+                                                ~0L, ZPixmap);
+
+# ifdef HAVE_XSHM_EXTENSION
+
+       if (use_shm)
+         {
+               buffer_map = create_xshm_image(dpy, xgwa.visual, orig_map->depth,
+                                                                          ZPixmap, 0, &shm_info,
+                                                                          2*radius + speed + 2,
+                                                                          2*radius + speed + 2);
+               if (!buffer_map)
+                 use_shm = False;
+         }
+# endif /* HAVE_XSHM_EXTENSION */
+
+       if (!buffer_map)
+         {
+               buffer_map = XCreateImage(dpy, xgwa.visual,
+                                                                 orig_map->depth, ZPixmap, 0, 0,
+                                                                 2*radius + speed + 2, 2*radius + speed + 2,
+                                                                 8, 0);
+               buffer_map->data = (char *)
+                 calloc(buffer_map->height, buffer_map->bytes_per_line);
        }
 
-       /* initialize a "see-trough" matrix */
-       for (i = 0; i <= 2*radius; i++) {
-               for (j = 0 ; j <= 2*radius ; j++) {
-                       from[i][j][0]=i-radius/2;
-                       from[i][j][1]=j-radius/2;
-               }
+       init_round_lense();
+
+       for (i = 0; i < number; i++) {
+               new_rnd_coo(i);
+               if (number != 1)
+                       xy_coo[i].r = (i*radius)/(number-1); /* "randomize" initial */
+               else
+                        xy_coo[i].r = 0;
+               xy_coo[i].r_change = speed + (i%2)*2*(-speed);  /* values a bit */
+               xy_coo[i].xmove = speed + (i%2)*2*(-speed);
+               xy_coo[i].ymove = speed + (i%2)*2*(-speed);
        }
+}
 
-       /* initialize the distort matrix */
-       for (i = 0; i <= 2*radius; i++) {
-               for(j = 0; j <= 2*radius; j++) {
-                       double r;
+/* example: initializes a "see-trough" matrix */
+/* static void make_null_lense(void)
+{
+       int i, j;
+       for (i = 0; i < 2*radius+speed+2; i++) {
+               for (j = 0 ; j < 2*radius+speed+2 ; j++) {
+                       from[i][j][0]=i;
+                       from[i][j][1]=j;
+               }
+       } 
+}
+*/
+
+/* makes a lense with the Radius=loop and centred in
+ * the point (radius, radius)
+ */
+static void make_round_lense(int radius, int loop)
+{
+       int i, j;
+
+       for (i = 0; i < 2*radius+speed+2; i++) {
+               for(j = 0; j < 2*radius+speed+2; j++) {
+                       double r, d;
                        r = sqrt ((i-radius)*(i-radius)+(j-radius)*(j-radius));
-                       if (r < radius) {
-                               r = sin(r*(M_PI_2)/radius);
-                               if (i < radius)
-                                       from[i][j][0] = radius/2 + (i-radius)*r;
-                               else
-                                       from[i][j][0] = radius/2 + (i-radius)*r;
-                               if (j < radius)
-                                       from[i][j][1] = radius/2 + (j-radius)*r;
-                               else
-                                       from[i][j][1] = radius/2 + (j-radius)*r;
+                       d=r/loop;
+
+                       if (r < loop-1) {
+
+                               if (vortex) { /* vortex-twist effect */
+                                       double angle;
+               /* this one-line formula for getting a nice rotation angle is borrowed
+                * (with permission) from the whirl plugin for gimp,
+                * Copyright (C) 1996 Federico Mena Quintero
+                */
+               /* 2.5 is just a constant used because it looks good :) */
+                                       angle = 2.5*(1-r/loop)*(1-r/loop);
+
+                                       from[i][j][0] = radius + cos(angle -
+                                               atan2(radius-j,-(radius-i)))*r;
+                                       from[i][j][1] = radius + sin(angle -
+                                               atan2(radius-j,-(radius-i)))*r;
+
+                                       if (magnify) {
+                                               r = sin(d*M_PI_2);
+                                               if (blackhole && r != 0) /* blackhole effect */
+                                                       r = 1/r;
+                                               from[i][j][0] = radius + (from[i][j][0]-radius)*r;
+                                               from[i][j][1] = radius + (from[i][j][1]-radius)*r;
+                                       }
+                               } else { /* default is to magnify */
+                                       r = sin(d*M_PI_2);
+                               
+       /* raising r to different power here gives different amounts of
+        * distortion, a negative value sucks everything into a black hole
+        */
+                               /*      r = r*r; */
+                                       if (blackhole) /* blackhole effect */
+                                               r = 1/r;
+                                                                       /* bubble effect (and blackhole) */
+                                       from[i][j][0] = radius + (i-radius)*r;
+                                       from[i][j][1] = radius + (j-radius)*r;
+                               }
+                       } else { /* not inside loop */
+                               from[i][j][0] = i;
+                               from[i][j][1] = j;
+                       }
+               }
+       }
+}
+
+static void allocate_lense(void)
+{
+       int i, j;
+       /* maybe this should be redone so that from[][][] is in one block;
+        * then pointers could be used instead of arrays in some places (and
+        * maybe give a speedup - maybe also consume less memory)
+        */
+
+       from = (int ***)malloc((2*radius+speed+2) * sizeof(int **));
+       if (from == NULL) {
+               perror("distort");
+               exit(EXIT_FAILURE);
+       }
+       for (i = 0; i < 2*radius+speed+2; i++) {
+               from[i] = (int **)malloc((2*radius+speed+2) * sizeof(int *));
+               if (from[i] == NULL) {
+                       perror("distort");
+                       exit(EXIT_FAILURE);
+               }
+               for (j = 0; j < 2*radius+speed+2; j++) {
+                       from[i][j] = (int *)malloc(2 * sizeof(int));
+                       if (from[i][j] == NULL) {
+                               perror("distort");
+                               exit(EXIT_FAILURE);
                        }
                }
        }
+}
 
-       XSetGraphicsExposures(dpy, gc, False); /* stop events from XCopyArea */
+/* from_array in an array containing precalculated from matrices,
+ * this is a double faced mem vs speed trade, it's faster, but eats
+ * _a lot_ of mem for large radius (is there a bug here? I can't see it)
+ */
+static void init_round_lense(void)
+{
+       int k;
+
+       if (effect == &swamp_thing) {
+               from_array = (int ****)malloc((radius+1)*sizeof(int ***));
+               for (k=0; k <= radius; k++) {
+                       allocate_lense();
+                       make_round_lense(radius, k);
+                       from_array[k] = from;
+               }
+       } else { /* just allocate one from[][][] */
+               allocate_lense();
+               make_round_lense(radius,radius);
+       }
 }
 
-static void
-move_lens (int *x, int *y, int *xmove, int *ymove) {
-       if (*xmove==0)
-               *xmove=speed;
-       if (*ymove==0)
-               *ymove=speed;
-       if (*x==0)
-               *x = radius + (random() % (size_x-2*radius));
-       if (*y==0)
-               *y = radius + (random() % (size_y-2*radius));
-       if (*x + 3*radius/2 >= size_x)
-               *xmove = -abs(*xmove);
-       if (*x - radius/2 <= 0) 
-               *xmove = abs(*xmove);
-       if (*y + 3*radius/2 >= size_y)
-               *ymove = -abs(*ymove);
-       if (*y - radius/2 <= 0)
-               *ymove = abs(*ymove);
-
-       *x = *x + *xmove;
-       *y = *y + *ymove;
+
+/* generate an XImage of from[][][] and draw it on the screen */
+void draw(int k)
+{
+       int i, j;
+       for(i = 0 ; i < 2*radius+speed+2; i++) {
+               for(j = 0 ; j < 2*radius+speed+2 ; j++) {
+                       if (xy_coo[k].x+from[i][j][0] >= 0 &&
+                                       xy_coo[k].x+from[i][j][0] < xgwa.width &&
+                                       xy_coo[k].y+from[i][j][1] >= 0 &&
+                                       xy_coo[k].y+from[i][j][1] < xgwa.height)
+                               XPutPixel(buffer_map, i, j,
+                                               XGetPixel(orig_map,
+                                                       xy_coo[k].x+from[i][j][0],
+                                                       xy_coo[k].y+from[i][j][1]));
+               }
+       }
+
+       XPutImage(g_dpy, g_window, gc, buffer_map, 0, 0, xy_coo[k].x, xy_coo[k].y,
+                       2*radius+speed+2, 2*radius+speed+2);
 }
 
-static void distort (Display *dpy, Window window)
+/* create a new, random coordinate, that won't interfer with any other
+ * coordinates, as the drawing routines would be significantly slowed
+ * down if they were to handle serveral layers of distortions
+ */
+static void new_rnd_coo(int k)
 {
-       static int x, y, xmove=0, ymove=0;
-       int i,j;
-
-       move_lens (&x, &y, &xmove, &ymove);
-
-       XCopyArea(dpy, orig_map, buffer_map, gc,
-                       x-radius/2 - xmove, y-radius/2 - ymove,
-                       2*radius + abs(xmove), 2*radius + abs(ymove),
-                       0,0);
-
-       /* it's possible to lower the number of loop iterations by a factor
-        * of 4, but since it's the XCopyArea's which eat resources, and
-        * I've only supplied one distortion routine (which is circular),
-        * here's a check-if-inside circle variation of this for loop.
-        * Using both optimizations turns the matrix rendering into one
-        * ugly mess... I'm counting on gcc optimization ;)
-        */
+       int i;
 
-       for(i = 0 ; i <= 2*radius ; i++) {
-               for(j = 0 ; j <= 2*radius ; j++) {
-                       if (((radius-i)*(radius-i) + (j-radius)*(j-radius))
-                               < radius*radius) {
-                       XCopyArea (dpy, orig_map, buffer_map, gc,
-                                       x+from[i][j][0],
-                                       y+from[i][j][1],
-                                       1, 1, i + xmove, j+ymove);
-                       }
+       xy_coo[k].x = (random() % (xgwa.width-2*radius));
+       xy_coo[k].y = (random() % (xgwa.height-2*radius));
+       
+       for (i = 0; i < number; i++) {
+               if (i != k) {
+                       if ((abs(xy_coo[k].x - xy_coo[i].x) <= 2*radius+speed+2)
+                        && (abs(xy_coo[k].y - xy_coo[i].y) <= 2*radius+speed+2)) {
+                               xy_coo[k].x = (random() % (xgwa.width-2*radius));
+                               xy_coo[k].y = (random() % (xgwa.height-2*radius));
+                               i=-1; /* ugly */
+                       } 
+               }
+       }
+}
+
+/* move lens and handle bounces with walls and other lenses */
+static void move_lense(int k)
+{
+       int i;
+
+       if (xy_coo[k].x + 4*radius/2 >= xgwa.width)
+               xy_coo[k].xmove = -abs(xy_coo[k].xmove);
+       if (xy_coo[k].x <= speed) 
+               xy_coo[k].xmove = abs(xy_coo[k].xmove);
+       if (xy_coo[k].y + 4*radius/2 >= xgwa.height)
+               xy_coo[k].ymove = -abs(xy_coo[k].ymove);
+       if (xy_coo[k].y <= speed)
+               xy_coo[k].ymove = abs(xy_coo[k].ymove);
+
+       xy_coo[k].x = xy_coo[k].x + xy_coo[k].xmove;
+       xy_coo[k].y = xy_coo[k].y + xy_coo[k].ymove;
+
+       for (i = 0; i < number; i++) {
+               if ((i != k)
+               
+/* This commented test is for rectangular lenses (not presently used) and
+ * the one used is for circular ones
+               && (abs(xy_coo[k].x - xy_coo[i].x) <= 2*radius)
+               && (abs(xy_coo[k].y - xy_coo[i].y) <= 2*radius)) { */
+
+               && ((xy_coo[k].x - xy_coo[i].x)*(xy_coo[k].x - xy_coo[i].x)
+                 + (xy_coo[k].y - xy_coo[i].y)*(xy_coo[k].y - xy_coo[i].y)
+                       <= 2*radius*2*radius)) {
+
+                       int x, y;
+                       x = xy_coo[k].xmove;
+                       y = xy_coo[k].ymove;
+                       xy_coo[k].xmove = xy_coo[i].xmove;
+                       xy_coo[k].ymove = xy_coo[i].ymove;
+                       xy_coo[i].xmove = x;
+                       xy_coo[i].ymove = y;
                }
        }
 
-       XCopyArea(dpy, buffer_map, window, gc, 0, 0,
-                       2*radius + abs(xmove), 2*radius + abs(ymove),
-                       x-radius/2 - xmove, y-radius/2 - ymove);
 }
 
+/* make xy_coo[k] grow/shrink */
+void swamp_thing(int k)
+{
+       if (xy_coo[k].r >= radius)
+               xy_coo[k].r_change = -abs(xy_coo[k].r_change);
+       
+       if (xy_coo[k].r <= 0) {
+               from = from_array[0];
+               draw(k); 
+               xy_coo[k].r_change = abs(xy_coo[k].r_change);
+               new_rnd_coo(k);
+               xy_coo[k].r=xy_coo[k].r_change;
+               return;
+       }
+
+       xy_coo[k].r = xy_coo[k].r + xy_coo[k].r_change;
+
+       if (xy_coo[k].r >= radius)
+               xy_coo[k].r = radius;
+       if (xy_coo[k].r <= 0)
+               xy_coo[k].r=0;
+
+       from = from_array[xy_coo[k].r];
+}
+
+
 \f
 
 char *progclass = "Distort";
@@ -178,8 +464,17 @@ char *defaults [] = {
 #endif
 
        "*delay:                        10000",
-       "*radius:                       60",
-       "*speed:                        2",
+       "*radius:                       0",
+       "*speed:                        0",
+       "*number:                       0",
+       "*vortex:                       False",
+       "*magnify:                      False",
+       "*swamp:                        False",
+       "*bounce:                       False",
+       "*blackhole:            False",
+#ifdef HAVE_XSHM_EXTENSION
+       "*useSHM:                       False",         /* xshm turns out not to help. */
+#endif /* HAVE_XSHM_EXTENSION */
        0
 };
 
@@ -187,15 +482,33 @@ XrmOptionDescRec options [] = {
        { "-delay",     ".delay",       XrmoptionSepArg, 0 },
        { "-radius",    ".radius",      XrmoptionSepArg, 0 },
        { "-speed",     ".speed",       XrmoptionSepArg, 0 },
+       { "-number",    ".number",      XrmoptionSepArg, 0 },
+       { "-swamp",     ".swamp",       XrmoptionNoArg, "True" },
+       { "-bounce",    ".bounce",      XrmoptionNoArg, "True" },
+       { "-vortex",    ".vortex",      XrmoptionNoArg, "True" },
+       { "-magnify",   ".magnify",     XrmoptionNoArg, "True" },
+       { "-blackhole", ".blackhole",   XrmoptionNoArg, "True" },
+#ifdef HAVE_XSHM_EXTENSION
+       { "-shm",               ".useSHM",      XrmoptionNoArg, "True" },
+       { "-no-shm",    ".useSHM",      XrmoptionNoArg, "False" },
+#endif /* HAVE_XSHM_EXTENSION */
        { 0, 0, 0, 0 }
 };
-               
 
-void screenhack (Display *dpy, Window window) {
+
+void screenhack(Display *dpy, Window window)
+{
+       int k;
+
        init_distort (dpy, window);
        while (1) {
-               distort (dpy, window);
-               XSync (dpy, True);
-               if (delay) usleep (delay);
+               for (k = 0; k < number; k++) {
+                       effect(k);
+                       draw(k);
+               }
+
+               XSync(dpy, True);
+               if (delay) usleep(delay);
        }
+
 }
index a99958329e04c0c7934f3a33b2c4cc384634ed41..6e5399fea4f7eb14fea62ecdc0f13534895a61ae 100644 (file)
@@ -20,7 +20,7 @@ static const char sccsid[] = "@(#)drift.c     4.02 97/04/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 01-Jan-97: Moved new flame to drift.  Compile time options now run time.
  * 01-Jun-95: Updated by Scott Draves.
  * 27-Jun-91: vary number of functions used.
index 5cc6977504e2c16bd387deb18acc3d5332400073..407f06a39dd4fd9467ad5a8affb3ac6264552564 100644 (file)
@@ -72,4 +72,4 @@ supporting documentation.
 Scott Draves <spot@cs.cmu.edu>, 06-Jun-91, 01-Jun-95.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index bbe905a1065b1e397ca8a3254adee461982a439f..3af0ed5f13b510b1de7281ac8169c98db7b73fd5 100644 (file)
@@ -13,7 +13,7 @@
 ..
 .TH XScreenSaver 1 "27-Apr-97" "X Version 11"
 .SH NAME
-qix - bounce colored lines around a window
+epicycle - draws a point moving around a circle which moves around a cicle which...
 .SH SYNOPSIS
 .B epicycle 
 [\-display \fIhost:display.screen\fP] [\-root] [\-window] [\-mono] [\-install] [\-noinstall] [\-visual \fIviz\fP] [\-colors \fIN\fP] [\-foreground \fIname\fP] [\-color\-shift \fIN\fP] [\-delay \fImicroseconds\fP] [\-holdtime \fIseconds\fP] [\-linewidth \fIN\fP] [\-min_circles \fIN\fP] [\-max_circles \fIN\fP] [\-min_speed \fInumber\fP] [\-max_speed \fInumber\fP] [\-harmonics \fIN\fP] [\-timestep \fInumber\fP] [\-divisor_poisson \fIprobability\fP] [\-size_factor_min \fInumber\fP] [\-size_factor_max \fInumber\fP]
index 643aff104e536d692dd534b377ee6c746dda6dbf..f34ead3e8cb90d24aac2e0ddc255fea687de0a94 100644 (file)
@@ -27,7 +27,7 @@ static const char sccsid[] = "@(#)flag.c      4.02 97/04/01 xlockmore";
  * 22-Jan-98: jwz: made the flag wigglier; added xpm support.
  *            (I tried to do this by re-porting from xlockmore, but the
  *            current xlockmore version is completely inscrutable.)
- * 13-May-97: jwz@netscape.com: turned into a standalone program.
+ * 13-May-97: jwz@jwz.org: turned into a standalone program.
  *                       Made it able to animate arbitrary (runtime) text or bitmaps.
  * 01-May-96: written.
  */
@@ -82,14 +82,15 @@ static const char sccsid[] = "@(#)flag.c    4.02 97/04/01 xlockmore";
 #ifdef STANDALONE
 static XrmOptionDescRec opts[] =
 {
-  { "-bitmap", ".flag.bitmap", XrmoptionSepArg, 0 }
+  { "-bitmap", ".flag.bitmap", XrmoptionSepArg, 0 },
+  { "-text",   ".flag.text",   XrmoptionSepArg, 0 }
 };
 
 #endif /* STANDALONE */
 
 ModeSpecOpt flag_opts = {
 #ifdef STANDALONE
-  1, opts, 0, NULL, NULL
+  2, opts, 0, NULL, NULL
 #else  /* !STANDALONE */
   0, NULL, 0, NULL, NULL
 #endif /* STANDALONE */
index 897a1f25b1ffe06069e4eb0c9503c420beabc965..1c7d93bfad1ce635f0c9c0120370744bf7c82f65 100644 (file)
@@ -85,4 +85,4 @@ supporting documentation.
 Charles Vidal <vidalc@univ-mlv.fr>, 1996.
 
 Ability to run standalone or with \fIxscreensaver\fP, and the \-text
-and \-bitmap options, added by Jamie Zawinski <jwz@netscape.com>, 24-May-97.
+and \-bitmap options, added by Jamie Zawinski <jwz@jwz.org>, 24-May-97.
index 851b26151a84dfd79b34fe5545d683383848f64b..521d3cb7400f6b525554d299e770404e56530d22 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1993, 1995, 1996
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 5c3f7b669145a28d87ea61c2098a7bcc0baddf60..a64697377e61f42dad2e43512c5a55be8e1dc535 100644 (file)
@@ -67,4 +67,4 @@ supporting documentation.
 Scott Graves <spot@cs.cmu.edu>, 06-Jun-91.n
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 18-Oct-93.
+Jamie Zawinski <jwz@jwz.org>, 18-Oct-93.
index a584cf7bd93b3aa31360b7306cfe98151af1af86..9f2d2c69d7427ed670cd6e8bb3c3086d5321631a 100644 (file)
@@ -60,4 +60,4 @@ supporting documentation.
 Pascal Pensa <pensa@aurora.unice.fr>, 1995.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 27-May-97.
+Jamie Zawinski <jwz@jwz.org>, 27-May-97.
index 0a8694bf500edf0dbe05738f6ba337cc5eec897a..b75ff03e3eae35587c2fd8fe131ce1dd4a163681 100644 (file)
@@ -24,7 +24,7 @@ static const char sccsid[] = "@(#)galaxy.c    4.04 97/07/28 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 18-Apr-97: Memory leak fixed by Tom Schmidt <tschmidt@micron.com>
  * 07-Apr-97: Modified by Dave Mitchell <davem@magnet.com>
  * 23-Oct-94: Modified by David Bagley <bagleyd@bigfoot.com>
index 8a4fe4c5f2b5c1f88e6b014bc9aaf6aa243cc8f7..2ef9e1236410e4b921c37b9b35394566012310ae 100644 (file)
@@ -80,4 +80,4 @@ Modified by David Bagley <bagleyd@bigfoot.com>, 23-Oct-94.
 Modified by Dave Mitchell <davem@magnet.com>, 7-Apr-97.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index f85df1cfd59659410c9af49963633a7a13f4697d..ad865e505b7a958a28f266e8c2d323133b215f16 100644 (file)
@@ -38,10 +38,12 @@ X_LIBS              = @X_LIBS@
 X_PRE_LIBS     = @X_PRE_LIBS@
 X_EXTRA_LIBS   = @X_EXTRA_LIBS@
 
-# Note: see comment in ../driver/Makefile.in for explanation of X_LIBS, etc.
+# Note: see comment in ../../driver/Makefile.in for explanation of X_LIBS, etc.
 #
-HACK_LIBS      = $(LIBS) $(X_LIBS) $(X_PRE_LIBS) @GL_LIBS@ @HACK_LIBS@ \
-                 -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm
+HACK_PRE       = $(LIBS) $(X_LIBS)
+HACK_POST      = $(X_PRE_LIBS) -lXt -lX11 -lXext $(X_EXTRA_LIBS) -lm
+HACK_LIBS      = $(HACK_PRE)            @GL_LIBS@ @HACK_LIBS@ $(HACK_POST)
+XPM_LIBS       = $(HACK_PRE) @XPM_LIBS@ @GL_LIBS@ @HACK_LIBS@ $(HACK_POST)
 
 HACK_SRC       = $(srcdir)/..
 HACK_BIN       = ..
@@ -61,16 +63,16 @@ SRCS                = atlantis.c buildlwo.c cage.c dolphin.c gears.c moebius.c \
                  morph3d.c pipeobjs.c pipes.c rubik.c s1_1.c s1_2.c s1_3.c \
                  s1_4.c s1_5.c s1_6.c s1_b.c shark.c sproingies.c \
                  sproingiewrap.c stairs.c superquadrics.c swim.c whale.c \
-                 xlock-gl.c
+                 xlock-gl.c lament.c bubble3d.c
 
 OBJS           = atlantis.o buildlwo.o cage.o dolphin.o gears.o moebius.o \
                  morph3d.o pipeobjs.o pipes.o rubik.o s1_1.o s1_2.o s1_3.o \
                  s1_4.o s1_5.o s1_6.o s1_b.o shark.o sproingies.o \
                  sproingiewrap.o stairs.o superquadrics.o swim.o whale.o \
-                 xlock-gl.o
+                 xlock-gl.o lament.o bubble3d.o
 
 GL_EXES                = cage gears moebius pipes sproingies stairs superquadrics \
-                 morph3d rubik atlantis
+                 morph3d rubik atlantis lament bubble3d
 EXES           = @GL_EXES@
 
 HACK_OBJS      = screenhack-gl.o xlock-gl.o $(HACK_BIN)/xlockmore.o \
@@ -79,7 +81,7 @@ HACK_OBJS     = screenhack-gl.o xlock-gl.o $(HACK_BIN)/xlockmore.o \
                  $(UTILS_BIN)/hsv.o $(UTILS_BIN)/colors.o
 
 HDRS           = atlantis.h buildlwo.h e_textures.h
-MEN            = 
+MEN            = lament.man
 EXTRAS         = README Makefile.in
 
 TARFILES       = $(SRCS) $(HDRS) $(MEN) $(EXTRAS)
@@ -128,7 +130,7 @@ clean:
        -rm -f *.o a.out core $(EXES)
 
 distclean: clean
-       -rm -f Makefile *~ "#"*
+       -rm -f Makefile TAGS *~ "#"*
 
 # Adds all current dependencies to Makefile
 depend:
@@ -235,10 +237,17 @@ SPROINGIES = sproingiewrap.o buildlwo.o \
 sproingies: sproingies.o $(HACK_OBJS) $(SPROINGIES)
        $(CC_HACK) -o $@ $@.o   $(HACK_OBJS) $(SPROINGIES) $(HACK_LIBS)
 
+lament:                lament.o        $(HACK_OBJS)
+       $(CC_HACK) -o $@ $@.o   $(HACK_OBJS) $(XPM_LIBS)
+
+B3D = b_sphere.o b_draw.o b_lockglue.o
+bubble3d:      bubble3d.o      $(HACK_OBJS) $(B3D)
+       $(CC_HACK) -o $@ $@.o   $(HACK_OBJS) $(B3D) $(HACK_LIBS)
 
 ##############################################################################
 #
 # DO NOT DELETE: updated by make distdepend
+# $(srcdir)/DO $(srcdir)/NOT $(srcdir)/DELETE: $(srcdir)/updated $(srcdir)/by $(srcdir)/make $(srcdir)/distdepend
 
 atlantis.o: $(HACK_SRC)/xlockmore.h
 atlantis.o: ../../config.h
@@ -251,6 +260,7 @@ atlantis.o: $(UTILS_SRC)/hsv.h
 atlantis.o: $(UTILS_SRC)/colors.h
 atlantis.o: $(UTILS_SRC)/grabscreen.h
 atlantis.o: $(UTILS_SRC)/visual.h
+atlantis.o: $(UTILS_SRC)/xshm.h
 atlantis.o: $(srcdir)/atlantis.h
 buildlwo.o: $(srcdir)/buildlwo.h
 cage.o: $(HACK_SRC)/xlockmore.h
@@ -264,6 +274,7 @@ cage.o: $(UTILS_SRC)/hsv.h
 cage.o: $(UTILS_SRC)/colors.h
 cage.o: $(UTILS_SRC)/grabscreen.h
 cage.o: $(UTILS_SRC)/visual.h
+cage.o: $(UTILS_SRC)/xshm.h
 cage.o: $(srcdir)/e_textures.h
 dolphin.o: $(srcdir)/atlantis.h
 gears.o: $(HACK_SRC)/xlockmore.h
@@ -277,6 +288,7 @@ gears.o: $(UTILS_SRC)/hsv.h
 gears.o: $(UTILS_SRC)/colors.h
 gears.o: $(UTILS_SRC)/grabscreen.h
 gears.o: $(UTILS_SRC)/visual.h
+gears.o: $(UTILS_SRC)/xshm.h
 moebius.o: $(HACK_SRC)/xlockmore.h
 moebius.o: ../../config.h
 moebius.o: $(HACK_SRC)/xlockmoreI.h
@@ -288,6 +300,7 @@ moebius.o: $(UTILS_SRC)/hsv.h
 moebius.o: $(UTILS_SRC)/colors.h
 moebius.o: $(UTILS_SRC)/grabscreen.h
 moebius.o: $(UTILS_SRC)/visual.h
+moebius.o: $(UTILS_SRC)/xshm.h
 moebius.o: $(srcdir)/e_textures.h
 morph3d.o: $(HACK_SRC)/xlockmore.h
 morph3d.o: ../../config.h
@@ -300,6 +313,7 @@ morph3d.o: $(UTILS_SRC)/hsv.h
 morph3d.o: $(UTILS_SRC)/colors.h
 morph3d.o: $(UTILS_SRC)/grabscreen.h
 morph3d.o: $(UTILS_SRC)/visual.h
+morph3d.o: $(UTILS_SRC)/xshm.h
 pipeobjs.o: $(srcdir)/buildlwo.h
 pipes.o: $(HACK_SRC)/xlockmore.h
 pipes.o: ../../config.h
@@ -312,6 +326,7 @@ pipes.o: $(UTILS_SRC)/hsv.h
 pipes.o: $(UTILS_SRC)/colors.h
 pipes.o: $(UTILS_SRC)/grabscreen.h
 pipes.o: $(UTILS_SRC)/visual.h
+pipes.o: $(UTILS_SRC)/xshm.h
 pipes.o: $(srcdir)/buildlwo.h
 rubik.o: $(HACK_SRC)/xlockmore.h
 rubik.o: ../../config.h
@@ -324,6 +339,7 @@ rubik.o: $(UTILS_SRC)/hsv.h
 rubik.o: $(UTILS_SRC)/colors.h
 rubik.o: $(UTILS_SRC)/grabscreen.h
 rubik.o: $(UTILS_SRC)/visual.h
+rubik.o: $(UTILS_SRC)/xshm.h
 s1_1.o: $(srcdir)/buildlwo.h
 s1_2.o: $(srcdir)/buildlwo.h
 s1_3.o: $(srcdir)/buildlwo.h
@@ -342,6 +358,7 @@ sproingies.o: $(UTILS_SRC)/hsv.h
 sproingies.o: $(UTILS_SRC)/colors.h
 sproingies.o: $(UTILS_SRC)/grabscreen.h
 sproingies.o: $(UTILS_SRC)/visual.h
+sproingies.o: $(UTILS_SRC)/xshm.h
 sproingies.o: $(srcdir)/buildlwo.h
 sproingiewrap.o: $(HACK_SRC)/xlockmore.h
 sproingiewrap.o: ../../config.h
@@ -354,6 +371,7 @@ sproingiewrap.o: $(UTILS_SRC)/hsv.h
 sproingiewrap.o: $(UTILS_SRC)/colors.h
 sproingiewrap.o: $(UTILS_SRC)/grabscreen.h
 sproingiewrap.o: $(UTILS_SRC)/visual.h
+sproingiewrap.o: $(UTILS_SRC)/xshm.h
 stairs.o: $(HACK_SRC)/xlockmore.h
 stairs.o: ../../config.h
 stairs.o: $(HACK_SRC)/xlockmoreI.h
@@ -365,6 +383,7 @@ stairs.o: $(UTILS_SRC)/hsv.h
 stairs.o: $(UTILS_SRC)/colors.h
 stairs.o: $(UTILS_SRC)/grabscreen.h
 stairs.o: $(UTILS_SRC)/visual.h
+stairs.o: $(UTILS_SRC)/xshm.h
 stairs.o: $(srcdir)/e_textures.h
 superquadrics.o: $(HACK_SRC)/xlockmore.h
 superquadrics.o: ../../config.h
@@ -377,6 +396,7 @@ superquadrics.o: $(UTILS_SRC)/hsv.h
 superquadrics.o: $(UTILS_SRC)/colors.h
 superquadrics.o: $(UTILS_SRC)/grabscreen.h
 superquadrics.o: $(UTILS_SRC)/visual.h
+superquadrics.o: $(UTILS_SRC)/xshm.h
 swim.o: $(HACK_SRC)/xlockmoreI.h
 swim.o: $(HACK_SRC)/screenhack.h
 swim.o: ../../config.h
@@ -387,6 +407,7 @@ swim.o: $(UTILS_SRC)/hsv.h
 swim.o: $(UTILS_SRC)/colors.h
 swim.o: $(UTILS_SRC)/grabscreen.h
 swim.o: $(UTILS_SRC)/visual.h
+swim.o: $(UTILS_SRC)/xshm.h
 swim.o: $(srcdir)/atlantis.h
 whale.o: $(srcdir)/atlantis.h
 xlock-gl.o: $(HACK_SRC)/screenhack.h
@@ -399,4 +420,30 @@ xlock-gl.o: $(UTILS_SRC)/colors.h
 xlock-gl.o: $(UTILS_SRC)/grabscreen.h
 xlock-gl.o: $(UTILS_SRC)/visual.h
 xlock-gl.o: $(HACK_SRC)/xlockmoreI.h
+xlock-gl.o: $(UTILS_SRC)/xshm.h
+lament.o: $(HACK_SRC)/xlockmore.h
+lament.o: ../../config.h
+lament.o: $(HACK_SRC)/xlockmoreI.h
+lament.o: $(HACK_SRC)/screenhack.h
+lament.o: $(UTILS_SRC)/yarandom.h
+lament.o: $(UTILS_SRC)/usleep.h
+lament.o: $(UTILS_SRC)/resources.h
+lament.o: $(UTILS_SRC)/hsv.h
+lament.o: $(UTILS_SRC)/colors.h
+lament.o: $(UTILS_SRC)/grabscreen.h
+lament.o: $(UTILS_SRC)/visual.h
+lament.o: $(UTILS_SRC)/xshm.h
+lament.o: $(HACK_SRC)/images/lament.xpm
+bubble3d.o: $(srcdir)/bubble3d.h
+bubble3d.o: $(HACK_SRC)/xlockmoreI.h
+bubble3d.o: $(HACK_SRC)/screenhack.h
+bubble3d.o: ../../config.h
+bubble3d.o: $(UTILS_SRC)/yarandom.h
+bubble3d.o: $(UTILS_SRC)/usleep.h
+bubble3d.o: $(UTILS_SRC)/resources.h
+bubble3d.o: $(UTILS_SRC)/hsv.h
+bubble3d.o: $(UTILS_SRC)/colors.h
+bubble3d.o: $(UTILS_SRC)/grabscreen.h
+bubble3d.o: $(UTILS_SRC)/visual.h
+bubble3d.o: $(UTILS_SRC)/xshm.h
 
index 36a58c5404078b727a6f995a3f653af57db10557..140295c1fe22d86cfe3cdb95dc334b3cd1d6f99b 100644 (file)
@@ -1,7 +1,7 @@
 /* atlantis --- Shows moving 3D sea animals */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)atlantis.c   1.1 98/05/13 xlockmore";
+static const char sccsid[] = "@(#)atlantis.c   1.3 98/06/18 xlockmore";
 
 #endif
 
@@ -34,11 +34,29 @@ static const char sccsid[] = "@(#)atlantis.c        1.1 98/05/13 xlockmore";
  *
  * Eric Lassauge  (May-13-1998)
  *
- * TODO : - use def_xxx options to initialize local variables (number of
- *          sharks, etc...)
- *        - test standalone mode
- *       - better colormap handling (problems somewhere ?)
- *       - purify it (!)
+ * REVISION HISTORY:
+ * 
+ * David A. Bagley - 98/06/17 : Add whalespeed option. Global options to
+ *                              initialize local variables are now:
+ *                              XLock.atlantis.cycles: 100      ! SharkSpeed
+ *                              XLock.atlantis.batchcount: 4    ! SharkNum
+ *                              XLock.atlantis.whalespeed: 250  ! WhaleSpeed
+ *                              XLock.atlantis.size: 6000       ! SharkSize
+ *                              Add random direction for whales/dolphins
+ * 
+ * E.Lassauge - 98/06/16: Use the following global options to initialize
+ *                        local variables :
+ *                              XLock.atlantis.delay: 100       ! SharkSpeed
+ *                              XLock.atlantis.batchcount: 4    ! SharkNum
+ *                              XLock.atlantis.cycles: 250      ! WhaleSpeed
+ *                              XLock.atlantis.size: 6000       ! SharkSize
+ *                        Add support for -/+ wireframe (t'was so easy to do!)
+ *
+ * TODO : 
+ *        - add a sort of background image or random bg color
+ *        - better handling of sizes and speeds
+ *        - test standalone and module modes
+ *        - purify it (!)
  */
 
 /* Copyright (c) Mark J. Kilgard, 1994. */
@@ -85,31 +103,48 @@ static const char sccsid[] = "@(#)atlantis.c       1.1 98/05/13 xlockmore";
 # define HACK_INIT     init_atlantis
 # define HACK_DRAW     draw_atlantis
 # define atlantis_opts xlockmore_opts
-# define DEFAULTS      "*delay:        1000 \n"
+# define DEFAULTS      "*delay:        1000 \n" \
+                        "*count:          4 \n" \
+                        "*cycles:       100 \n" \
+                        "*size:        6000 \n" \
+                        "*whalespeed:   250 \n"
 # include "xlockmore.h"                /* from the xscreensaver distribution */
 #else  /* !STANDALONE */
 # include "xlock.h"            /* from the xlockmore distribution */
-
+#include "vis.h"
 #endif /* !STANDALONE */
 
 #ifdef USE_GL
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
 #include "atlantis.h"
 #include <GL/glu.h>
 
 
+#define DEF_WHALESPEED  "250"
+static int  whalespeed;
+static XrmOptionDescRec opts[] =
+{
+     {"-whalespeed", ".atlantis.whalespeed", XrmoptionSepArg, (caddr_t) NULL}
+};
+
+static argtype vars[] =
+{
+{(caddr_t *) & whalespeed, "whalespeed", "WhaleSpeed", DEF_WHALESPEED, t_Int}
+};
+
+static OptionStruct desc[] =
+{
+       {"-whalespeed num", "speed of whales and the dolphin"}
+};
+
 ModeSpecOpt atlantis_opts =
-{0, NULL, 0, NULL, NULL};
+{sizeof opts / sizeof opts[0], opts, sizeof vars / sizeof vars[0], vars, desc};
 
 #ifdef USE_MODULES
 ModStruct   atlantis_description =
 {"atlantis", "init_atlantis", "draw_atlantis", "release_atlantis",
  "refresh_atlantis", "change_atlantis", NULL, &atlantis_opts,
- 1000, 2, 5, 500, 64, 1.0, "",
+ 1000, NUM_SHARKS, SHARKSPEED, SHARKSIZE, 64, 1.0, "",
  "Shows moving sharks/whales/dolphin", 0, NULL};
 
 #endif
@@ -117,151 +152,151 @@ ModStruct   atlantis_description =
 static atlantisstruct *atlantis = NULL;
 
 static void
-InitFishs(atlantisstruct *ap)
+InitFishs(atlantisstruct * ap)
 {
-    int i;
-
-    for (i = 0; i < NUM_SHARKS; i++) {
-        ap->sharks[i].x = 70000.0 + NRAND(6000);
-        ap->sharks[i].y = NRAND(6000);
-        ap->sharks[i].z = NRAND(6000);
-        ap->sharks[i].psi = NRAND(360) - 180.0;
-        ap->sharks[i].v = 1.0;
-    }
-
-               /* i = LRAND() & 1; */ /* Works the first time but they do not return */
-    ap->dolph.x = 30000.0;
-    ap->dolph.y = 0.0;
-    ap->dolph.z = 6000.0;
-    ap->dolph.psi = /* (i) ? 90.0 : - */ 90.0;
-    ap->dolph.theta = 0.0;
-    ap->dolph.v = 3.0;
-
-    ap->momWhale.x = 70000.0;
-    ap->momWhale.y = 0.0;
-    ap->momWhale.z = 0.0;
-    ap->momWhale.psi = /* (i) ? 90.0 : - */ 90.0;
-    ap->momWhale.theta = 0.0;
-    ap->momWhale.v = 3.0;
-
-    ap->babyWhale.x = 60000.0;
-    ap->babyWhale.y = -2000.0;
-    ap->babyWhale.z = -2000.0;
-    ap->babyWhale.psi = /* (i) ? 90.0 : - */ 90.0;
-    ap->babyWhale.theta = 0.0;
-    ap->babyWhale.v = 3.0;
+       int         i;
+
+       for (i = 0; i < ap->num_sharks; i++) {
+               ap->sharks[i].x = 70000.0 + NRAND(ap->sharksize);
+               ap->sharks[i].y = NRAND(ap->sharksize);
+               ap->sharks[i].z = NRAND(ap->sharksize);
+               ap->sharks[i].psi = NRAND(360) - 180.0;
+               ap->sharks[i].v = 1.0;
+       }
+
+       /* Random whae direction */
+       ap->whaledir = LRAND() & 1;
+
+       ap->dolph.x = 30000.0;
+       ap->dolph.y = 0.0;
+       ap->dolph.z = (float) (ap->sharksize);
+       ap->dolph.psi = (ap->whaledir) ? 90.0 : -90.0;
+       ap->dolph.theta = 0.0;
+       ap->dolph.v = 6.0;
+
+       ap->momWhale.x = 70000.0;
+       ap->momWhale.y = 0.0;
+       ap->momWhale.z = 0.0;
+       ap->momWhale.psi = (ap->whaledir) ? 90.0 : -90.0;
+       ap->momWhale.theta = 0.0;
+       ap->momWhale.v = 3.0;
+
+       ap->babyWhale.x = 60000.0;
+       ap->babyWhale.y = -2000.0;
+       ap->babyWhale.z = -2000.0;
+       ap->babyWhale.psi = (ap->whaledir) ? 90.0 : -90.0;
+       ap->babyWhale.theta = 0.0;
+       ap->babyWhale.v = 3.0;
 }
 
 static void
-Init(atlantisstruct *ap)
+Init(atlantisstruct * ap)
 {
-    static float ambient[] =
-    {0.1, 0.1, 0.1, 1.0};
-    static float diffuse[] =
-    {1.0, 1.0, 1.0, 1.0};
-    static float position[] =
-    {0.0, 1.0, 0.0, 0.0};
-    static float mat_shininess[] =
-    {90.0};
-    static float mat_specular[] =
-    {0.8, 0.8, 0.8, 1.0};
-    static float mat_diffuse[] =
-    {0.46, 0.66, 0.795, 1.0};
-    static float mat_ambient[] =
-    {0.0, 0.1, 0.2, 1.0};
-    static float lmodel_ambient[] =
-    {0.4, 0.4, 0.4, 1.0};
-    static float lmodel_localviewer[] =
-    {0.0};
-#if 0
-    GLfloat map1[4] =
-    {0.0, 0.0, 0.0, 0.0};
-    GLfloat map2[4] =
-    {0.0, 0.0, 0.0, 0.0};
-#endif
-
-    glFrontFace(GL_CW);
-
-    glDepthFunc(GL_LEQUAL);
-    glEnable(GL_DEPTH_TEST);
-
-    glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
-    glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
-    glLightfv(GL_LIGHT0, GL_POSITION, position);
-    glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
-    glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer);
-    glEnable(GL_LIGHTING);
-    glEnable(GL_LIGHT0);
-
-    glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
-    glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
-    glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
-    glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
-
-    InitFishs(ap);
-
-    glClearColor(0.0, 0.5, 0.9, 0.0);
+       static float ambient[] =
+       {0.1, 0.1, 0.1, 1.0};
+       static float diffuse[] =
+       {1.0, 1.0, 1.0, 1.0};
+       static float position[] =
+       {0.0, 1.0, 0.0, 0.0};
+       static float mat_shininess[] =
+       {90.0};
+       static float mat_specular[] =
+       {0.8, 0.8, 0.8, 1.0};
+       static float mat_diffuse[] =
+       {0.46, 0.66, 0.795, 1.0};
+       static float mat_ambient[] =
+       {0.0, 0.1, 0.2, 1.0};
+       static float lmodel_ambient[] =
+       {0.4, 0.4, 0.4, 1.0};
+       static float lmodel_localviewer[] =
+       {0.0};
+       float       fblue = 0.0, fgreen;
+
+       glFrontFace(GL_CW);
+
+       glDepthFunc(GL_LEQUAL);
+       glEnable(GL_DEPTH_TEST);
+
+       glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+       glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
+       glLightfv(GL_LIGHT0, GL_POSITION, position);
+       glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
+       glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_localviewer);
+       glEnable(GL_LIGHTING);
+       glEnable(GL_LIGHT0);
+
+       glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, mat_shininess);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_diffuse);
+       glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
+
+       InitFishs(ap);
+
+       /* Add a little randomness */
+       fblue = ((float) (NRAND(50)) / 100.0) + 0.50;
+       fgreen = fblue * 0.56;
+       glClearColor(0.0, fgreen, fblue, 0.0);
 }
 
 static void
-Reshape(ModeInfo *mi,int width, int height)
+Reshape(ModeInfo * mi, int width, int height)
 {
-    atlantisstruct *ap = &atlantis[MI_SCREEN(mi)];
+       atlantisstruct *ap = &atlantis[MI_SCREEN(mi)];
 
-    glViewport(0, 0, ap->WinW= (GLint) width, ap->WinH= (GLint) height);
+       glViewport(0, 0, ap->WinW = (GLint) width, ap->WinH = (GLint) height);
 
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    gluPerspective(400.0, (GLdouble)width/(GLdouble)height, 1.0, 2000000.0);
-    glMatrixMode(GL_MODELVIEW);
+       glMatrixMode(GL_PROJECTION);
+       glLoadIdentity();
+       gluPerspective(400.0, (GLdouble) width / (GLdouble) height, 1.0, 2000000.0);
+       glMatrixMode(GL_MODELVIEW);
 }
 
 static void
-Animate(atlantisstruct *ap)
+Animate(atlantisstruct * ap)
 {
-    int i;
-
-    for (i = 0; i < NUM_SHARKS; i++) {
-        SharkPilot(&(ap->sharks[i]));
-        SharkMiss(ap,i);
-    }
-    WhalePilot(&(ap->dolph));
-    ap->dolph.phi++;
-    WhalePilot(&(ap->momWhale));
-    ap->momWhale.phi++;
-    WhalePilot(&(ap->babyWhale));
-    ap->babyWhale.phi++;
+       int         i;
+
+       for (i = 0; i < ap->num_sharks; i++) {
+               SharkPilot(&(ap->sharks[i]), ap->sharkspeed);
+               SharkMiss(ap, i);
+       }
+       WhalePilot(&(ap->dolph), ap->whalespeed, ap->whaledir);
+       ap->dolph.phi++;
+       WhalePilot(&(ap->momWhale), ap->whalespeed, ap->whaledir);
+       ap->momWhale.phi++;
+       WhalePilot(&(ap->babyWhale), ap->whalespeed, ap->whaledir);
+       ap->babyWhale.phi++;
 }
 
 static void
-AllDisplay(atlantisstruct *ap)
+AllDisplay(atlantisstruct * ap)
 {
-    int i;
-
-    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
-    for (i = 0; i < NUM_SHARKS; i++) {
-        glPushMatrix();
-        FishTransform(&(ap->sharks[i]));
-        DrawShark(&(ap->sharks[i]));
-        glPopMatrix();
-    }
-
-    glPushMatrix();
-    FishTransform(&(ap->dolph));
-    DrawDolphin(&(ap->dolph));
-    glPopMatrix();
-
-    glPushMatrix();
-    FishTransform(&(ap->momWhale));
-    DrawWhale(&(ap->momWhale));
-    glPopMatrix();
-
-    glPushMatrix();
-    FishTransform(&(ap->babyWhale));
-    glScalef(0.45, 0.45, 0.3);
-    DrawWhale(&(ap->babyWhale));
-    glPopMatrix();
+       int         i;
+
+       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+       for (i = 0; i < ap->num_sharks; i++) {
+               glPushMatrix();
+               FishTransform(&(ap->sharks[i]));
+               DrawShark(&(ap->sharks[i]), ap->wire);
+               glPopMatrix();
+       }
+
+       glPushMatrix();
+       FishTransform(&(ap->dolph));
+       DrawDolphin(&(ap->dolph), ap->wire);
+       glPopMatrix();
+
+       glPushMatrix();
+       FishTransform(&(ap->momWhale));
+       DrawWhale(&(ap->momWhale), ap->wire);
+       glPopMatrix();
+
+       glPushMatrix();
+       FishTransform(&(ap->babyWhale));
+       glScalef(0.45, 0.45, 0.3);
+       DrawWhale(&(ap->babyWhale), ap->wire);
+       glPopMatrix();
 }
 
 /*
@@ -288,11 +323,38 @@ init_atlantis(ModeInfo * mi)
 
        if (atlantis == NULL) {
                if ((atlantis = (atlantisstruct *) calloc(MI_NUM_SCREENS(mi),
-                                              sizeof (atlantisstruct))) == NULL)
+                                          sizeof (atlantisstruct))) == NULL)
                        return;
        }
        ap = &atlantis[screen];
-
+       ap->num_sharks = MI_COUNT(mi);
+       if (ap->sharks == NULL) {
+               if ((ap->sharks = (fishRec *) calloc(ap->num_sharks,
+                                               sizeof (fishRec))) == NULL) {
+                       /* free everything up to now */
+                       (void) free((void *) atlantis);
+                       atlantis = NULL;
+                       return;
+               }
+       }
+       ap->sharkspeed = MI_CYCLES(mi);         /* has influence on the "width"
+                                                  of the movement */
+       ap->sharksize = MI_SIZE(mi);    /* has influence on the "distance"
+                                          of the sharks */
+       ap->whalespeed = whalespeed;
+       ap->wire = MI_IS_WIREFRAME(mi);
+
+       if (MI_IS_DEBUG(mi)) {
+               (void) fprintf(stderr,
+                              "%s:\n\tnum_sharks=%d\n\tsharkspeed=%.1f\n\tsharksize=%d\n\twhalespeed=%.1f\n\twireframe=%s\n",
+                              MI_NAME(mi),
+                              ap->num_sharks,
+                              ap->sharkspeed,
+                              ap->sharksize,
+                              ap->whalespeed,
+                              ap->wire ? "yes" : "no"
+                       );
+       }
        if ((ap->glx_context = init_GL(mi)) != NULL) {
 
                Reshape(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
@@ -319,6 +381,8 @@ draw_atlantis(ModeInfo * mi)
        Display    *display = MI_DISPLAY(mi);
        Window      window = MI_WINDOW(mi);
 
+       MI_IS_DRAWN(mi) = True;
+
        if (!ap->glx_context)
                return;
 
@@ -346,26 +410,24 @@ draw_atlantis(ModeInfo * mi)
 void
 release_atlantis(ModeInfo * mi)
 {
+       int         screen;
+
        if (atlantis != NULL) {
+               for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) {
+                       atlantisstruct *ap = &atlantis[screen];
+
+                       if (ap->sharks)
+                               (void) free((void *) ap->sharks);
+               }
                (void) free((void *) atlantis);
                atlantis = NULL;
        }
        FreeAllGL(mi);
 }
 
-/*
- *-----------------------------------------------------------------------------
- *    Called when the mainline xlock code notices possible window
- *      damage.  This hook should take steps to repaint the entire
- *      window (no specific damage area information is provided).
- *-----------------------------------------------------------------------------
- */
-
 void
 refresh_atlantis(ModeInfo * mi)
 {
-    MI_CLEARWINDOW(mi);
-    Reshape(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
 }
 
 void
@@ -377,7 +439,7 @@ change_atlantis(ModeInfo * mi)
                return;
 
        glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(ap->glx_context));
-       Init(ap);
+       Init(ap);
 }
 
-#endif /* USE_GL */
+#endif /* USE_GL */
index 914e5c1039fe50c4afe447d2e532ba221ab9bcef..413b48b853448a4ee4518baaec420f07b7c10e80 100644 (file)
 #define RAD 57.295
 #define RRAD 0.01745
 
+/* default values */
 #define NUM_SHARKS 4
+#define SHARKSPEED 100
 #define SHARKSIZE 6000
-#define SHARKSPEED 100.0
-
-#define WHALESPEED 250.0
 
 typedef struct _fishRec {
-    float x, y, z, phi, theta, psi, v;
-    float xt, yt, zt;
-    float htail, vtail;
-    float dtheta;
-    int spurt, attack;
+       float       x, y, z, phi, theta, psi, v;
+       float       xt, yt, zt;
+       float       htail, vtail;
+       float       dtheta;
+       int         spurt, attack;
 } fishRec;
 
 typedef struct {
-        GLint       WinH, WinW;
-        GLXContext *glx_context;
-        fishRec sharks[NUM_SHARKS];
-        fishRec momWhale;
-        fishRec babyWhale;
-        fishRec dolph;
+       GLint       WinH, WinW;
+       GLXContext *glx_context;
+       int         num_sharks;
+       float       sharkspeed, whalespeed;
+       int         sharksize;
+       int         wire;
+       Bool        whaledir;
+       fishRec    *sharks;
+       fishRec     momWhale;
+       fishRec     babyWhale;
+       fishRec     dolph;
 } atlantisstruct;
 
 extern void FishTransform(fishRec *);
-extern void WhalePilot(fishRec *);
-extern void SharkPilot(fishRec *);
-extern void SharkMiss(atlantisstruct *,int);
-extern void DrawWhale(fishRec *);
-extern void DrawShark(fishRec *);
-extern void DrawDolphin(fishRec *);
+extern void WhalePilot(fishRec *, float, Bool);
+extern void SharkPilot(fishRec *, float);
+extern void SharkMiss(atlantisstruct *, int);
+extern void DrawWhale(fishRec *, int);
+extern void DrawShark(fishRec *, int);
+extern void DrawDolphin(fishRec *, int);
diff --git a/hacks/glx/bubble3d.c b/hacks/glx/bubble3d.c
new file mode 100644 (file)
index 0000000..dd5b68e
--- /dev/null
@@ -0,0 +1,264 @@
+/* -*- Mode: C; tab-width: 4 -*- */
+/* bubble3d.c - 3D bubbles  */
+
+#if !defined( lint ) && !defined( SABER )
+static const char sccsid[] = "@(#)bubble3d.c  4.11 98/06/16 xlockmore";
+
+#endif
+
+/*-
+ * BUBBLE3D (C) 1998 Richard W.M. Jones.
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind.  The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof.  In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Revision History:
+ * 16-Jun-98: Written.
+ *
+ * bubble.c: This code is responsible for creating and managing
+ * bubbles over their lifetime.
+ * The bubbles may be drawn inside out.
+ */
+
+#include "bubble3d.h"
+
+typedef struct bubble {
+       GLfloat    *contributions;      /* List of contributions from each
+                                        * nudge to each vertex. This list has
+                                        * length nr_vertices * nr_nudge_axes.
+                                        */
+       GLfloat     x, y, z;    /* (x,y,z) location of the bubble. */
+       GLfloat     scale;      /* Scaling factor applied to bubble. */
+       GLfloat     y_incr, scale_incr;         /* Change in y and scale each frame. */
+       GLfloat     rotx, roty, rotz;   /* Current rotation. */
+       GLfloat     rotx_incr, roty_incr, rotz_incr;    /* Amount by which we increase
+                                                        * rotation each step.
+                                                        */
+       GLfloat    *nudge_angle;        /* Current angle (radians) of each
+                                        * nudge. This list has length nr_nudge_axes.
+                                        */
+       GLfloat    *nudge_angle_incr;   /* Amount by which we increase each nudge
+                                        * angle in each frame.
+                                        */
+} bubble;
+
+/* Should be taken care of already... but just in case */
+#if !defined( __GNUC__ ) && !defined(__cplusplus) && !defined(c_plusplus)
+#undef inline
+#define inline                 /* */
+#endif
+static inline void
+normalize(GLfloat v[3])
+{
+       GLfloat     d = (GLfloat) sqrt((double) (v[0] * v[0] + v[1] * v[1] +
+                                                v[2] * v[2]));
+
+       if (d != 0) {
+               v[0] /= d;
+               v[1] /= d;
+               v[2] /= d;
+       } else {
+               v[0] = v[1] = v[2] = 0;
+       }
+}
+
+static inline GLfloat
+dotprod(GLfloat * v1, GLfloat * v2)
+{
+       return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2];
+}
+
+static inline GLfloat
+max(GLfloat a, GLfloat b)
+{
+       return a > b ? a : b;
+}
+
+/* Create a new bubble. */
+void       *
+glb_bubble_new(GLfloat x, GLfloat y, GLfloat z, GLfloat scale,
+              GLfloat y_incr, GLfloat scale_incr)
+{
+       int         i, j;
+
+       /* GLfloat axes [glb_config.nr_nudge_axes][3]; */
+       GLfloat     axes[5][3]; /* HARD CODED for SunCC */
+       int         nr_vertices;
+       glb_vertex *vertices = glb_sphere_get_vertices(&nr_vertices);
+
+       bubble     *b = (bubble *) malloc(sizeof *b);
+
+       if (b == 0)
+               return 0;
+
+       b->contributions = (GLfloat *) malloc(sizeof (GLfloat) * nr_vertices *
+                                             glb_config.nr_nudge_axes);
+       if (b->contributions == 0) {
+               (void) free((void *) b);
+               return 0;
+       }
+       b->nudge_angle = (GLfloat *) malloc(sizeof (GLfloat) * glb_config.nr_nudge_axes);
+       if (b->nudge_angle == 0) {
+               (void) free((void *) b->contributions);
+               (void) free((void *) b);
+               return 0;
+       }
+       b->nudge_angle_incr = (GLfloat *) malloc(sizeof (GLfloat) * glb_config.nr_nudge_axes);
+       if (b->nudge_angle_incr == 0) {
+               (void) free((void *) b->nudge_angle);
+               (void) free((void *) b->contributions);
+               (void) free((void *) b);
+               return 0;
+       }
+       /* Initialize primitive elements. */
+       b->x = x;
+       b->y = y;
+       b->z = z;
+       b->scale = scale;
+       b->y_incr = y_incr;
+       b->scale_incr = scale_incr;
+       b->rotx = b->roty = b->rotz = 0;
+       b->rotx_incr = glb_drand() * glb_config.rotation_factor * 2
+               - glb_config.rotation_factor;
+       b->roty_incr = glb_drand() * glb_config.rotation_factor * 2
+               - glb_config.rotation_factor;
+       b->rotz_incr = glb_drand() * glb_config.rotation_factor * 2
+               - glb_config.rotation_factor;
+
+       /* Initialize the nudge angle arrays. */
+       for (i = 0; i < glb_config.nr_nudge_axes; ++i) {
+               b->nudge_angle[i] = 0;
+               b->nudge_angle_incr[i] = glb_drand() * glb_config.nudge_angle_factor;
+       }
+
+       /* Choose some random nudge axes. */
+       for (i = 0; i < glb_config.nr_nudge_axes; ++i) {
+               axes[i][0] = glb_drand() * 2 - 1;
+               axes[i][1] = glb_drand() * 2 - 1;
+               axes[i][2] = glb_drand() * 2 - 1;
+               normalize(axes[i]);
+       }
+
+       /* Calculate the contribution that each nudge axis has on each vertex. */
+       for (i = 0; i < nr_vertices; ++i)
+               for (j = 0; j < glb_config.nr_nudge_axes; ++j)
+                       b->contributions[i * glb_config.nr_nudge_axes + j]
+                               = max(0, dotprod(vertices[i], axes[j]));
+
+       return (void *) b;
+}
+
+/* Delete a bubble and free up all memory. */
+void
+glb_bubble_delete(void *bb)
+{
+       bubble     *b = (bubble *) bb;
+
+       if (b != NULL) {
+               if (b->nudge_angle_incr) {
+                       (void) free((void *) b->nudge_angle_incr);
+                       b->nudge_angle_incr = NULL;
+               }
+               if (b->nudge_angle) {
+                       (void) free((void *) b->nudge_angle);
+                       b->nudge_angle = NULL;
+               }
+               if (b->contributions) {
+                       (void) free((void *) b->contributions);
+                       b->contributions = NULL;
+               }
+               (void) free((void *) b);
+               b = NULL;
+       }
+}
+
+/* Rotate and wobble a bubble by a single step. */
+void
+glb_bubble_step(void *bb)
+{
+       int         i;
+       bubble     *b = (bubble *) bb;
+
+       /* Update the rotation. */
+       b->rotx += b->rotx_incr;
+       b->roty += b->roty_incr;
+       b->rotz += b->rotz_incr;
+
+       /* Update the nudge angles. */
+       for (i = 0; i < glb_config.nr_nudge_axes; ++i)
+               b->nudge_angle[i] += b->nudge_angle_incr[i];
+
+       /* Move it upwards & outwards. */
+       b->y += b->y_incr;
+       b->scale += b->scale_incr;
+}
+
+/* Draw a bubble. */
+void
+glb_bubble_draw(void *bb)
+{
+       int         i, j;
+       bubble     *b = (bubble *) bb;
+       int         nr_vertices;
+       glb_vertex *vertices = glb_sphere_get_vertices(&nr_vertices);
+       int         nr_triangles;
+       glb_triangle *triangles = glb_sphere_get_triangles(&nr_triangles);
+       glb_vertex *new_vertices;
+
+       new_vertices = (glb_vertex *) malloc(sizeof (glb_vertex) * nr_vertices);
+       /* Calculate the vertices of this bubble, factoring in each nudge axis. */
+       for (i = 0; i < nr_vertices; ++i) {
+               GLfloat     s = 0;
+
+               for (j = 0; j < glb_config.nr_nudge_axes; ++j)
+                       s += ((GLfloat) cos((double) (b->nudge_angle[j])) *
+                             glb_config.nudge_factor - glb_config.nudge_factor / 2) *
+                               b->contributions[i * glb_config.nr_nudge_axes + j];
+
+               new_vertices[i][0] = vertices[i][0] * (s + 1);
+               new_vertices[i][1] = vertices[i][1] * (s + 1);
+               new_vertices[i][2] = vertices[i][2] * (s + 1);
+       }
+
+       glPushMatrix();
+
+       /* Apply translation, rotation and scalings. */
+       glTranslatef(b->x, b->y, b->z);
+
+       glRotatef(b->rotx, 1, 0, 0);
+       glRotatef(b->roty, 0, 1, 0);
+       glRotatef(b->rotz, 0, 0, 1);
+
+       glScalef(b->scale, b->scale, b->scale);
+
+       /* Draw the bubble. */
+       glBegin(GL_TRIANGLES);
+       for (i = 0; i < nr_triangles; ++i) {
+               glNormal3fv(new_vertices[triangles[i][0]]);
+               glVertex3fv(new_vertices[triangles[i][0]]);
+               glNormal3fv(new_vertices[triangles[i][1]]);
+               glVertex3fv(new_vertices[triangles[i][1]]);
+               glNormal3fv(new_vertices[triangles[i][2]]);
+               glVertex3fv(new_vertices[triangles[i][2]]);
+       }
+       glEnd();
+       glPopMatrix();
+       (void) free((void *) new_vertices);
+}
+
+/* Return y value. */
+GLfloat
+glb_bubble_get_y(void *bb)
+{
+       bubble     *b = (bubble *) bb;
+
+       return b->y;
+}
index 2a831893f7524941d29578855a184aecc3f3eb13..412c719f9398b7f7410094081e85a8ceafa9dbea 100644 (file)
@@ -392,6 +392,8 @@ draw_cage(ModeInfo * mi)
        Display    *display = MI_DISPLAY(mi);
        Window      window = MI_WINDOW(mi);
 
+       MI_IS_DRAWN(mi) = True;
+
        if (!cp->glx_context)
                return;
 
index 130d932d3187f2955e112d9e36d38dcfea22540e..67406d2047e8c01b2e41ab0aea916be1b26f813e 100644 (file)
@@ -1,7 +1,7 @@
 /* atlantis --- Shows moving 3D sea animals */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)dolphin.c    1.1 98/05/13 xlockmore";
+static const char sccsid[] = "@(#)dolphin.c    1.2 98/06/16 xlockmore";
 
 #endif
 
@@ -72,6 +72,7 @@ static const char sccsid[] = "@(#)dolphin.c   1.1 98/05/13 xlockmore";
  *
  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  */
+
 #ifndef STANDALONE
 #include "xlock.h"
 #endif
@@ -79,10 +80,10 @@ static const char sccsid[] = "@(#)dolphin.c 1.1 98/05/13 xlockmore";
 #ifdef USE_GL
 
 #ifdef STANDALONE
+#include <math.h>
 #include <GL/glx.h>
 #endif
 
-#include <math.h>
 #include "atlantis.h"
 /* *INDENT-OFF* */
 static float N001[3] = {-0.005937 ,-0.101998 ,-0.994767};
@@ -463,1603 +464,1607 @@ static float P133[3] = {442.28, -181.67, 9475.96};
 static float P134[3] = {442.08, -143.84, 9475.96};
 /* *INDENT-ON* */
 
+
+
 static void
-Dolphin001(void)
+Dolphin001(GLenum cap)
 {
-    glNormal3fv(N071);
-    glBegin(GL_POLYGON);
-    glVertex3fv(P001);
-    glVertex3fv(P068);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P068);
-    glVertex3fv(P076);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P068);
-    glVertex3fv(P070);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P076);
-    glVertex3fv(P070);
-    glVertex3fv(P074);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P070);
-    glVertex3fv(P072);
-    glVertex3fv(P074);
-    glEnd();
-    glNormal3fv(N119);
-    glBegin(GL_POLYGON);
-    glVertex3fv(P072);
-    glVertex3fv(P070);
-    glVertex3fv(P074);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P074);
-    glVertex3fv(P070);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P070);
-    glVertex3fv(P068);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P076);
-    glVertex3fv(P068);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P068);
-    glVertex3fv(P001);
-    glVertex3fv(P010);
-    glEnd();
+       glNormal3fv(N071);
+       glBegin(cap);
+       glVertex3fv(P001);
+       glVertex3fv(P068);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P068);
+       glVertex3fv(P076);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P068);
+       glVertex3fv(P070);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P076);
+       glVertex3fv(P070);
+       glVertex3fv(P074);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P070);
+       glVertex3fv(P072);
+       glVertex3fv(P074);
+       glEnd();
+       glNormal3fv(N119);
+       glBegin(cap);
+       glVertex3fv(P072);
+       glVertex3fv(P070);
+       glVertex3fv(P074);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P074);
+       glVertex3fv(P070);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P070);
+       glVertex3fv(P068);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P076);
+       glVertex3fv(P068);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P068);
+       glVertex3fv(P001);
+       glVertex3fv(P010);
+       glEnd();
 }
 
 static void
-Dolphin002(void)
+Dolphin002(GLenum cap)
 {
-    glNormal3fv(N071);
-    glBegin(GL_POLYGON);
-    glVertex3fv(P011);
-    glVertex3fv(P001);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P075);
-    glVertex3fv(P011);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P069);
-    glVertex3fv(P011);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P069);
-    glVertex3fv(P075);
-    glVertex3fv(P073);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P071);
-    glVertex3fv(P069);
-    glVertex3fv(P073);
-    glEnd();
-    glNormal3fv(N119);
-    glBegin(GL_POLYGON);
-    glVertex3fv(P001);
-    glVertex3fv(P011);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P009);
-    glVertex3fv(P011);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P011);
-    glVertex3fv(P069);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P069);
-    glVertex3fv(P073);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P069);
-    glVertex3fv(P071);
-    glVertex3fv(P073);
-    glEnd();
+       glNormal3fv(N071);
+       glBegin(cap);
+       glVertex3fv(P011);
+       glVertex3fv(P001);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P075);
+       glVertex3fv(P011);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P069);
+       glVertex3fv(P011);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P069);
+       glVertex3fv(P075);
+       glVertex3fv(P073);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P071);
+       glVertex3fv(P069);
+       glVertex3fv(P073);
+       glEnd();
+       glNormal3fv(N119);
+       glBegin(cap);
+       glVertex3fv(P001);
+       glVertex3fv(P011);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P009);
+       glVertex3fv(P011);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P011);
+       glVertex3fv(P069);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P069);
+       glVertex3fv(P073);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P069);
+       glVertex3fv(P071);
+       glVertex3fv(P073);
+       glEnd();
 }
 
 static void
-Dolphin003(void)
+Dolphin003(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glEnd();
 }
 
 static void
-Dolphin004(void)
+Dolphin004(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glEnd();
 }
 
 static void
-Dolphin005(void)
+Dolphin005(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glEnd();
 }
 
 static void
-Dolphin006(void)
+Dolphin006(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N093);
-    glVertex3fv(P093);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N093);
-    glVertex3fv(P093);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N122);
-    glVertex3fv(P122);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N122);
-    glVertex3fv(P122);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N093);
+       glVertex3fv(P093);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N093);
+       glVertex3fv(P093);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N122);
+       glVertex3fv(P122);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N122);
+       glVertex3fv(P122);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glEnd();
 }
 
 static void
-Dolphin007(void)
+Dolphin007(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glEnd();
 }
 
 static void
-Dolphin008(void)
+Dolphin008(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glEnd();
 }
 
 static void
-Dolphin009(void)
+Dolphin009(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
 }
 
 static void
-Dolphin010(void)
+Dolphin010(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N080);
-    glVertex3fv(P080);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N090);
-    glVertex3fv(P090);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N080);
-    glVertex3fv(P080);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glNormal3fv(N090);
-    glVertex3fv(P090);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N080);
+       glVertex3fv(P080);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N090);
+       glVertex3fv(P090);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N080);
+       glVertex3fv(P080);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glNormal3fv(N090);
+       glVertex3fv(P090);
+       glEnd();
 }
 
 static void
-Dolphin011(void)
+Dolphin011(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N082);
-    glVertex3fv(P082);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N082);
-    glVertex3fv(P082);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N082);
+       glVertex3fv(P082);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N082);
+       glVertex3fv(P082);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
 }
 
 static void
-Dolphin012(void)
+Dolphin012(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glEnd();
 }
 
 static void
-Dolphin013(void)
+Dolphin013(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glNormal3fv(N117);
-    glVertex3fv(P117);
-    glNormal3fv(N112);
-    glVertex3fv(P112);
-    glNormal3fv(N113);
-    glVertex3fv(P113);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N114);
-    glVertex3fv(P114);
-    glNormal3fv(N113);
-    glVertex3fv(P113);
-    glNormal3fv(N112);
-    glVertex3fv(P112);
-    glNormal3fv(N115);
-    glVertex3fv(P115);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N114);
-    glVertex3fv(P114);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glNormal3fv(N113);
-    glVertex3fv(P113);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N114);
-    glVertex3fv(P114);
-    glNormal3fv(N007);
-    glVertex3fv(P007);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N007);
-    glVertex3fv(P007);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P002);
-    glVertex3fv(P007);
-    glVertex3fv(P008);
-    glVertex3fv(P099);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P007);
-    glVertex3fv(P114);
-    glVertex3fv(P115);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N117);
-    glVertex3fv(P117);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N117);
-    glVertex3fv(P117);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N112);
-    glVertex3fv(P112);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N112);
-    glVertex3fv(P112);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N115);
-    glVertex3fv(P115);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glNormal3fv(N117);
+       glVertex3fv(P117);
+       glNormal3fv(N112);
+       glVertex3fv(P112);
+       glNormal3fv(N113);
+       glVertex3fv(P113);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N114);
+       glVertex3fv(P114);
+       glNormal3fv(N113);
+       glVertex3fv(P113);
+       glNormal3fv(N112);
+       glVertex3fv(P112);
+       glNormal3fv(N115);
+       glVertex3fv(P115);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N114);
+       glVertex3fv(P114);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glNormal3fv(N113);
+       glVertex3fv(P113);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N114);
+       glVertex3fv(P114);
+       glNormal3fv(N007);
+       glVertex3fv(P007);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N007);
+       glVertex3fv(P007);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P002);
+       glVertex3fv(P007);
+       glVertex3fv(P008);
+       glVertex3fv(P099);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P007);
+       glVertex3fv(P114);
+       glVertex3fv(P115);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N117);
+       glVertex3fv(P117);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N117);
+       glVertex3fv(P117);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N112);
+       glVertex3fv(P112);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N112);
+       glVertex3fv(P112);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N115);
+       glVertex3fv(P115);
+       glEnd();
 }
 
 static void
-Dolphin014(void)
+Dolphin014(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N111);
-    glVertex3fv(P111);
-    glNormal3fv(N110);
-    glVertex3fv(P110);
-    glNormal3fv(N102);
-    glVertex3fv(P102);
-    glNormal3fv(N121);
-    glVertex3fv(P121);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N111);
-    glVertex3fv(P111);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glNormal3fv(N110);
-    glVertex3fv(P110);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glNormal3fv(N110);
-    glVertex3fv(P110);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P098);
-    glVertex3fv(P097);
-    glVertex3fv(P111);
-    glVertex3fv(P121);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P002);
-    glVertex3fv(P099);
-    glVertex3fv(P097);
-    glVertex3fv(P098);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N110);
-    glVertex3fv(P110);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glNormal3fv(N118);
-    glVertex3fv(P118);
-    glNormal3fv(N102);
-    glVertex3fv(P102);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N119);
-    glVertex3fv(P119);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N118);
-    glVertex3fv(P118);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N118);
-    glVertex3fv(P118);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N118);
-    glVertex3fv(P118);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N098);
-    glVertex3fv(P098);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N118);
-    glVertex3fv(P118);
-    glNormal3fv(N098);
-    glVertex3fv(P098);
-    glNormal3fv(N102);
-    glVertex3fv(P102);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N102);
-    glVertex3fv(P102);
-    glNormal3fv(N098);
-    glVertex3fv(P098);
-    glNormal3fv(N121);
-    glVertex3fv(P121);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N111);
+       glVertex3fv(P111);
+       glNormal3fv(N110);
+       glVertex3fv(P110);
+       glNormal3fv(N102);
+       glVertex3fv(P102);
+       glNormal3fv(N121);
+       glVertex3fv(P121);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N111);
+       glVertex3fv(P111);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glNormal3fv(N110);
+       glVertex3fv(P110);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glNormal3fv(N110);
+       glVertex3fv(P110);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P098);
+       glVertex3fv(P097);
+       glVertex3fv(P111);
+       glVertex3fv(P121);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P002);
+       glVertex3fv(P099);
+       glVertex3fv(P097);
+       glVertex3fv(P098);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N110);
+       glVertex3fv(P110);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glNormal3fv(N118);
+       glVertex3fv(P118);
+       glNormal3fv(N102);
+       glVertex3fv(P102);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N119);
+       glVertex3fv(P119);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N118);
+       glVertex3fv(P118);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N118);
+       glVertex3fv(P118);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N118);
+       glVertex3fv(P118);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N098);
+       glVertex3fv(P098);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N118);
+       glVertex3fv(P118);
+       glNormal3fv(N098);
+       glVertex3fv(P098);
+       glNormal3fv(N102);
+       glVertex3fv(P102);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N102);
+       glVertex3fv(P102);
+       glNormal3fv(N098);
+       glVertex3fv(P098);
+       glNormal3fv(N121);
+       glVertex3fv(P121);
+       glEnd();
 }
 
 static void
-Dolphin015(void)
+Dolphin015(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glNormal3fv(N117);
-    glVertex3fv(P117);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glNormal3fv(N117);
-    glVertex3fv(P117);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N120);
-    glVertex3fv(P120);
-    glNormal3fv(N116);
-    glVertex3fv(P116);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glNormal3fv(N117);
+       glVertex3fv(P117);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glNormal3fv(N117);
+       glVertex3fv(P117);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N120);
+       glVertex3fv(P120);
+       glNormal3fv(N116);
+       glVertex3fv(P116);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
 }
 
 static void
-Dolphin016(void)
+Dolphin016(GLenum cap)
 {
 
-    glDisable(GL_DEPTH_TEST);
-    glBegin(GL_POLYGON);
-    glVertex3fv(P123);
-    glVertex3fv(P124);
-    glVertex3fv(P125);
-    glVertex3fv(P126);
-    glVertex3fv(P127);
-    glVertex3fv(P128);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P129);
-    glVertex3fv(P130);
-    glVertex3fv(P131);
-    glVertex3fv(P132);
-    glVertex3fv(P133);
-    glVertex3fv(P134);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P103);
-    glVertex3fv(P105);
-    glVertex3fv(P108);
-    glEnd();
-    glEnable(GL_DEPTH_TEST);
+       glDisable(GL_DEPTH_TEST);
+       glBegin(cap);
+       glVertex3fv(P123);
+       glVertex3fv(P124);
+       glVertex3fv(P125);
+       glVertex3fv(P126);
+       glVertex3fv(P127);
+       glVertex3fv(P128);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P129);
+       glVertex3fv(P130);
+       glVertex3fv(P131);
+       glVertex3fv(P132);
+       glVertex3fv(P133);
+       glVertex3fv(P134);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P103);
+       glVertex3fv(P105);
+       glVertex3fv(P108);
+       glEnd();
+       glEnable(GL_DEPTH_TEST);
 }
 
 void
-DrawDolphin(fishRec * fish)
+DrawDolphin(fishRec * fish, int wire)
 {
-    float seg0, seg1, seg2, seg3, seg4, seg5, seg6, seg7;
-    float pitch, thrash, chomp;
+       float       seg0, seg1, seg2, seg3, seg4, seg5, seg6, seg7;
+       float       pitch, thrash, chomp;
+       GLenum      cap;
 
-    fish->htail = (int) (fish->htail - (int) (10.0 * fish->v)) % 360;
+       fish->htail = (int) (fish->htail - (int) (10.0 * fish->v)) % 360;
 
-    thrash = 70.0 * fish->v;
+       thrash = 70.0 * fish->v;
 
-    seg0 = 1.0 * thrash * sin((fish->htail) * RRAD);
-    seg3 = 1.0 * thrash * sin((fish->htail) * RRAD);
-    seg1 = 2.0 * thrash * sin((fish->htail + 4.0) * RRAD);
-    seg2 = 3.0 * thrash * sin((fish->htail + 6.0) * RRAD);
-    seg4 = 4.0 * thrash * sin((fish->htail + 10.0) * RRAD);
-    seg5 = 4.5 * thrash * sin((fish->htail + 15.0) * RRAD);
-    seg6 = 5.0 * thrash * sin((fish->htail + 20.0) * RRAD);
-    seg7 = 6.0 * thrash * sin((fish->htail + 30.0) * RRAD);
+       seg0 = 1.0 * thrash * sin((fish->htail) * RRAD);
+       seg3 = 1.0 * thrash * sin((fish->htail) * RRAD);
+       seg1 = 2.0 * thrash * sin((fish->htail + 4.0) * RRAD);
+       seg2 = 3.0 * thrash * sin((fish->htail + 6.0) * RRAD);
+       seg4 = 4.0 * thrash * sin((fish->htail + 10.0) * RRAD);
+       seg5 = 4.5 * thrash * sin((fish->htail + 15.0) * RRAD);
+       seg6 = 5.0 * thrash * sin((fish->htail + 20.0) * RRAD);
+       seg7 = 6.0 * thrash * sin((fish->htail + 30.0) * RRAD);
 
-    pitch = fish->v * sin((fish->htail + 180.0) * RRAD);
+       pitch = fish->v * sin((fish->htail + 180.0) * RRAD);
 
-    if (fish->v > 2.0) {
-        chomp = -(fish->v - 2.0) * 200.0;
-    }
-    chomp = 100.0;
+       if (fish->v > 2.0) {
+               chomp = -(fish->v - 2.0) * 200.0;
+       }
+       chomp = 100.0;
 
-    P012[1] = iP012[1] + seg5;
-    P013[1] = iP013[1] + seg5;
-    P014[1] = iP014[1] + seg5;
-    P015[1] = iP015[1] + seg5;
-    P016[1] = iP016[1] + seg5;
-    P017[1] = iP017[1] + seg5;
-    P018[1] = iP018[1] + seg5;
-    P019[1] = iP019[1] + seg5;
+       P012[1] = iP012[1] + seg5;
+       P013[1] = iP013[1] + seg5;
+       P014[1] = iP014[1] + seg5;
+       P015[1] = iP015[1] + seg5;
+       P016[1] = iP016[1] + seg5;
+       P017[1] = iP017[1] + seg5;
+       P018[1] = iP018[1] + seg5;
+       P019[1] = iP019[1] + seg5;
 
-    P020[1] = iP020[1] + seg4;
-    P021[1] = iP021[1] + seg4;
-    P022[1] = iP022[1] + seg4;
-    P023[1] = iP023[1] + seg4;
-    P024[1] = iP024[1] + seg4;
-    P025[1] = iP025[1] + seg4;
-    P026[1] = iP026[1] + seg4;
-    P027[1] = iP027[1] + seg4;
+       P020[1] = iP020[1] + seg4;
+       P021[1] = iP021[1] + seg4;
+       P022[1] = iP022[1] + seg4;
+       P023[1] = iP023[1] + seg4;
+       P024[1] = iP024[1] + seg4;
+       P025[1] = iP025[1] + seg4;
+       P026[1] = iP026[1] + seg4;
+       P027[1] = iP027[1] + seg4;
 
-    P028[1] = iP028[1] + seg2;
-    P029[1] = iP029[1] + seg2;
-    P030[1] = iP030[1] + seg2;
-    P031[1] = iP031[1] + seg2;
-    P032[1] = iP032[1] + seg2;
-    P033[1] = iP033[1] + seg2;
-    P034[1] = iP034[1] + seg2;
-    P035[1] = iP035[1] + seg2;
+       P028[1] = iP028[1] + seg2;
+       P029[1] = iP029[1] + seg2;
+       P030[1] = iP030[1] + seg2;
+       P031[1] = iP031[1] + seg2;
+       P032[1] = iP032[1] + seg2;
+       P033[1] = iP033[1] + seg2;
+       P034[1] = iP034[1] + seg2;
+       P035[1] = iP035[1] + seg2;
 
-    P036[1] = iP036[1] + seg1;
-    P037[1] = iP037[1] + seg1;
-    P038[1] = iP038[1] + seg1;
-    P039[1] = iP039[1] + seg1;
-    P040[1] = iP040[1] + seg1;
-    P041[1] = iP041[1] + seg1;
-    P042[1] = iP042[1] + seg1;
-    P043[1] = iP043[1] + seg1;
+       P036[1] = iP036[1] + seg1;
+       P037[1] = iP037[1] + seg1;
+       P038[1] = iP038[1] + seg1;
+       P039[1] = iP039[1] + seg1;
+       P040[1] = iP040[1] + seg1;
+       P041[1] = iP041[1] + seg1;
+       P042[1] = iP042[1] + seg1;
+       P043[1] = iP043[1] + seg1;
 
-    P044[1] = iP044[1] + seg0;
-    P045[1] = iP045[1] + seg0;
-    P046[1] = iP046[1] + seg0;
-    P047[1] = iP047[1] + seg0;
-    P048[1] = iP048[1] + seg0;
-    P049[1] = iP049[1] + seg0;
-    P050[1] = iP050[1] + seg0;
-    P051[1] = iP051[1] + seg0;
+       P044[1] = iP044[1] + seg0;
+       P045[1] = iP045[1] + seg0;
+       P046[1] = iP046[1] + seg0;
+       P047[1] = iP047[1] + seg0;
+       P048[1] = iP048[1] + seg0;
+       P049[1] = iP049[1] + seg0;
+       P050[1] = iP050[1] + seg0;
+       P051[1] = iP051[1] + seg0;
 
-    P009[1] = iP009[1] + seg6;
-    P010[1] = iP010[1] + seg6;
-    P075[1] = iP075[1] + seg6;
-    P076[1] = iP076[1] + seg6;
+       P009[1] = iP009[1] + seg6;
+       P010[1] = iP010[1] + seg6;
+       P075[1] = iP075[1] + seg6;
+       P076[1] = iP076[1] + seg6;
 
-    P001[1] = iP001[1] + seg7;
-    P011[1] = iP011[1] + seg7;
-    P068[1] = iP068[1] + seg7;
-    P069[1] = iP069[1] + seg7;
-    P070[1] = iP070[1] + seg7;
-    P071[1] = iP071[1] + seg7;
-    P072[1] = iP072[1] + seg7;
-    P073[1] = iP073[1] + seg7;
-    P074[1] = iP074[1] + seg7;
+       P001[1] = iP001[1] + seg7;
+       P011[1] = iP011[1] + seg7;
+       P068[1] = iP068[1] + seg7;
+       P069[1] = iP069[1] + seg7;
+       P070[1] = iP070[1] + seg7;
+       P071[1] = iP071[1] + seg7;
+       P072[1] = iP072[1] + seg7;
+       P073[1] = iP073[1] + seg7;
+       P074[1] = iP074[1] + seg7;
 
-    P091[1] = iP091[1] + seg3;
-    P092[1] = iP092[1] + seg3;
-    P093[1] = iP093[1] + seg3;
-    P094[1] = iP094[1] + seg3;
-    P095[1] = iP095[1] + seg3;
-    P122[1] = iP122[1] + seg3 * 1.5;
+       P091[1] = iP091[1] + seg3;
+       P092[1] = iP092[1] + seg3;
+       P093[1] = iP093[1] + seg3;
+       P094[1] = iP094[1] + seg3;
+       P095[1] = iP095[1] + seg3;
+       P122[1] = iP122[1] + seg3 * 1.5;
 
-    P097[1] = iP097[1] + chomp;
-    P098[1] = iP098[1] + chomp;
-    P102[1] = iP102[1] + chomp;
-    P110[1] = iP110[1] + chomp;
-    P111[1] = iP111[1] + chomp;
-    P121[1] = iP121[1] + chomp;
-    P118[1] = iP118[1] + chomp;
-    P119[1] = iP119[1] + chomp;
+       P097[1] = iP097[1] + chomp;
+       P098[1] = iP098[1] + chomp;
+       P102[1] = iP102[1] + chomp;
+       P110[1] = iP110[1] + chomp;
+       P111[1] = iP111[1] + chomp;
+       P121[1] = iP121[1] + chomp;
+       P118[1] = iP118[1] + chomp;
+       P119[1] = iP119[1] + chomp;
 
-    glPushMatrix();
+       glPushMatrix();
 
-    glRotatef(pitch, 1.0, 0.0, 0.0);
+       glRotatef(pitch, 1.0, 0.0, 0.0);
 
-    glTranslatef(0.0, 0.0, 7000.0);
+       glTranslatef(0.0, 0.0, 7000.0);
 
-    glRotatef(180.0, 0.0, 1.0, 0.0);
+       glRotatef(180.0, 0.0, 1.0, 0.0);
 
-    glEnable(GL_CULL_FACE);
-    Dolphin014();
-    Dolphin010();
-    Dolphin009();
-    Dolphin012();
-    Dolphin013();
-    Dolphin006();
-    Dolphin002();
-    Dolphin001();
-    Dolphin003();
-    Dolphin015();
-    Dolphin004();
-    Dolphin005();
-    Dolphin007();
-    Dolphin008();
-    Dolphin011();
-    Dolphin016();
-    glDisable(GL_CULL_FACE);
+       glEnable(GL_CULL_FACE);
+       cap = wire ? GL_LINE_LOOP : GL_POLYGON;
+       Dolphin014(cap);
+       Dolphin010(cap);
+       Dolphin009(cap);
+       Dolphin012(cap);
+       Dolphin013(cap);
+       Dolphin006(cap);
+       Dolphin002(cap);
+       Dolphin001(cap);
+       Dolphin003(cap);
+       Dolphin015(cap);
+       Dolphin004(cap);
+       Dolphin005(cap);
+       Dolphin007(cap);
+       Dolphin008(cap);
+       Dolphin011(cap);
+       Dolphin016(cap);
+       glDisable(GL_CULL_FACE);
 
-    glPopMatrix();
+       glPopMatrix();
 }
 #endif
diff --git a/hacks/glx/lament.c b/hacks/glx/lament.c
new file mode 100644 (file)
index 0000000..75321a4
--- /dev/null
@@ -0,0 +1,2207 @@
+/* xscreensaver, Copyright (c) 1998 Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+/* Animates Lemarchand's Box, the Lament Configuration.  By jwz, 25-Jul-98.
+
+   TODO:
+
+     *  The "gold" color isn't quite right; it looks more like "yellow" than
+        "gold" to me.
+
+     *  For some reason, the interior surfaces are shinier than the exterior
+        surfaces.  I don't understand why, but this should be remedied.
+
+     *  Perhaps use a slightly-bumpy or oily texture for the interior surfaces?
+
+     *  Some of the edges don't line up perfectly (since the images are not
+        perfectly symetrical.)  Something should be done about this; either
+        making the edges overlap slightly (instead of leaving gaps) or fixing
+        the images so that the edges may be symmetrical.
+
+     *  I want the gold leaf to seem to be raised up from the surface, but I
+        think this isn't possible with OpenGL.  Supposedly, OpenGL only 
+        supports Gouraud shading (interpolating edge normals from face normals,
+        and shading smoothly) but bump-maps only work with Phong shading
+        (computing a normal for each rendered pixel.)
+
+     *  As far as I can tell, OpenGL doesn't do shadows.  As a result, the
+        forward-facing interior walls are drawn bright, not dark.  If it was
+        casting shadows properly, it wouldn't matter so much that the edges
+        don't quite line up, because the lines would be black, and thus not
+        visible.  But the edges don't match up, and so the bright interior
+        faces show through, and that sucks.
+
+       But apparently there are tricky ways around this:
+       http://reality.sgi.com/opengl/tips/rts/
+       I think these techniques require GLUT, however, which isn't 
+       (currently) required by any other xscreensaver hacks.
+
+     *  There should be strange lighting effects playing across the surface:
+        electric sparks, or little glittery blobs of light.  
+        http://reality.sgi.com/opengl/tips/lensflare/ might provide guidance.
+
+     *  Need to add some more modes, to effect the transition from the cube
+        shapes to the "spike" or "leviathan" shapes.  I have extensive notes
+        on how these transformations occur, but unfortunately, due to camera
+        trickery, the transitions require dematerializations which do not
+        preserve object volume.  But I suppose that's allowed, in
+        non-Euclidian or hyperdimensional spaces (since the extra mass could
+        simply be rotated along the axis to which one cannot point.)
+
+        The other hard thing about this is that the "leviathan" shapes contain
+        a much larger number of facets, and I modelled this whole thing by 
+        hand, since I don't have any 3d-object-editing tools that I know how
+        to use (or that look like they would take any less than several months
+        to become even marginally proficient with...)
+
+     *  Perhaps there should be a table top, on which it casts a shadow?
+        And then multiple light sources (for multiple shadows)?
+
+     *  Needs music.  ("Hellraiser Themes" by Coil: TORSO CD161; also
+        duplicated on the "Unnatural History 2" compilation, WORLN M04699.)
+
+     *  I'm not totally happy with the spinning motion; I like the
+        acceleration and deceleration, but it often feels like it's going too
+        fast, or not naturally enough, or something.
+
+     *  However, the motion is better than that used by gears, superquadrics,
+        etc.; so maybe I should make them all share the same motion code.
+ */
+
+#include <X11/Intrinsic.h>
+
+#define PROGCLASS      "Lament"
+#define HACK_INIT      init_lament
+#define HACK_DRAW      draw_lament
+#define lament_opts    xlockmore_opts
+#define DEFAULTS       "*delay:        10000   \n"     \
+                       "*wireframe:    False   \n"     \
+                       "*texture:      True    \n"
+#include "xlockmore.h"
+
+#ifdef USE_GL /* whole file */
+
+#undef countof
+#define countof(x) (sizeof((x))/sizeof((*x)))
+
+#define DEF_TEXTURE "True"
+
+static int do_texture;
+static XrmOptionDescRec opts[] = {
+  {"-texture", ".lament.texture", XrmoptionNoArg, (caddr_t) "true" },
+  {"+texture", ".lament.texture", XrmoptionNoArg, (caddr_t) "false" },
+};
+
+static argtype vars[] = {
+  {(caddr_t *) &do_texture, "texture", "Texture", DEF_TEXTURE, t_Bool},
+};
+
+ModeSpecOpt lament_opts = {countof(opts), opts, countof(vars), vars, NULL};
+
+#ifdef HAVE_XPM
+# include <X11/xpm.h>
+# include "../images/lament.xpm"
+#endif /* HAVE_XPM */
+
+#define RAND(n) ((long) ((random() & 0x7fffffff) % ((long) (n))))
+#define RANDSIGN() ((random() & 1) ? 1 : -1)
+
+typedef enum {
+  LAMENT_BOX,
+
+  LAMENT_STAR_OUT,
+  LAMENT_STAR_ROT,
+  LAMENT_STAR_ROT_IN,
+  LAMENT_STAR_ROT_OUT,
+  LAMENT_STAR_UNROT,
+  LAMENT_STAR_IN,
+
+  LAMENT_TETRA_UNE,
+  LAMENT_TETRA_USW,
+  LAMENT_TETRA_DWN,
+  LAMENT_TETRA_DSE,
+
+  LAMENT_LID_OPEN,
+  LAMENT_LID_CLOSE,
+  LAMENT_LID_ZOOM,
+
+  LAMENT_TASER_OUT,
+  LAMENT_TASER_SLIDE,
+  LAMENT_TASER_SLIDE_IN,
+  LAMENT_TASER_IN
+
+} lament_type;
+
+static GLfloat exterior_color[] = { 0.70, 0.60, 0.00, 1.00 };
+static GLfloat interior_color[] = { 0.25, 0.25, 0.20, 1.00 };
+
+
+typedef struct {
+  GLXContext *glx_context;
+
+  GLuint box;                     /* display list IDs */
+  GLuint star1, star2;
+  GLuint tetra_une, tetra_usw, tetra_dwn, tetra_dse, tetra_mid;
+  GLuint lid_0, lid_1, lid_2, lid_3, lid_4;
+  GLuint taser_base, taser_lifter, taser_slider;
+
+  GLfloat rotx, roty, rotz;       /* current object rotation */
+  GLfloat dx, dy, dz;             /* current rotational velocity */
+  GLfloat ddx, ddy, ddz;          /* current rotational acceleration */
+  GLfloat d_max;                  /* max velocity */
+  XImage *texture;                /* image bits */
+  GLuint texids[6];               /* texture map IDs */
+  lament_type type;               /* which mode of the object is current */
+
+  int anim_pause;                 /* countdown before animating again */
+  GLfloat anim_r, anim_y, anim_z;  /* relative position during anims */
+
+} lament_configuration;
+
+static lament_configuration *lcs = NULL;
+
+#define FACE_N 3
+#define FACE_S 2
+#define FACE_E 0
+#define FACE_W 4
+#define FACE_U 5
+#define FACE_D 1
+
+#ifdef HAVE_XPM
+static Bool
+bigendian(void)
+{
+  union { int i; char c[sizeof(int)]; } u;
+  u.i = 1;
+  return !u.c[0];
+}
+#endif /* HAVE_XPM */
+
+
+static void
+parse_image_data(ModeInfo *mi)
+{
+#ifdef HAVE_XPM
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+
+  /* All we want to do is get RGB data out of the XPM file built in to this
+     program.  This is a pain, because there is no way  (as of XPM version
+     4.6, at least) to get libXpm to make an XImage without also allocating
+     colors with XAllocColor.  So, instead, we create an XpmImage and parse
+     out the RGB values of the pixels ourselves; and construct an XImage
+     by hand.  Regardless of the depth of the visual we're using, this
+     XImage will have 32 bits per pixel, 8 each per R, G, and B.  We put
+     0xFF in the fourth slot, as GL will interpret that as "alpha".
+   */
+  XpmImage xpm_image;
+  XpmInfo xpm_info;
+  int result;
+  int x, y, i;
+  int bpl, wpl;
+  XColor colors[255];
+  
+  result = XpmCreateXpmImageFromData(lament_faces, &xpm_image, &xpm_info);
+  if (result != XpmSuccess)
+    {
+      fprintf(stderr, "%s: unable to parse xpm data (%d).\n", progname,
+             result);
+      exit (1);
+    }
+
+  lc->texture = XCreateImage(mi->dpy, mi->xgwa.visual, 32, ZPixmap, 0, 0,
+                            xpm_image.width, xpm_image.height, 32, 0);
+
+  bpl = lc->texture->bytes_per_line;
+  wpl = bpl/4;
+
+  lc->texture->data = (char *) malloc(xpm_image.height * bpl);
+
+  /* Parse the colors in the XPM into RGB values. */
+  for (i = 0; i < xpm_image.ncolors; i++)
+    if (!XParseColor(mi->dpy, mi->xgwa.colormap,
+                    xpm_image.colorTable[i].c_color,
+                    &colors[i]))
+      {
+       fprintf(stderr, "%s: unparsable color: %s\n", progname,
+               xpm_image.colorTable[i].c_color);
+       exit(1);
+      }
+
+  /* Translate the XpmImage to an RGB XImage. */
+  {
+    int rpos, gpos, bpos, apos;  /* bitfield positions */
+
+    /* Note that unlike X, which is endianness-agnostic (since any XImage
+       can have its own specific bit ordering, with the server reversing
+       things as necessary) OpenGL pretends everything is client-side, so
+       we need to pack things in the right order for the client machine.
+     */
+    if (bigendian())
+      rpos = 24, gpos = 16, bpos =  8, apos =  0;
+    else
+      rpos =  0, gpos =  8, bpos = 16, apos = 24;
+
+    for (y = 0; y < xpm_image.height; y++)
+      {
+       int y2 = (xpm_image.height-1-y); /* Texture maps are upside down. */
+
+       unsigned int *oline = (unsigned int *) (lc->texture->data + (y *bpl));
+       unsigned int *iline = (unsigned int *) (xpm_image.data    + (y2*wpl));
+
+       for (x = 0; x < xpm_image.width; x++)
+         {
+           XColor *c = &colors[iline[x]];
+           /* pack it as RGBA */
+           oline[x] = (((c->red   >> 8) << rpos) |
+                       ((c->green >> 8) << gpos) |
+                       ((c->blue  >> 8) << bpos) |
+                       (0xFF            << apos));
+         }
+      }
+  }
+
+  /* I sure hope these only free the contents, and not the args. */
+  XpmFreeXpmImage(&xpm_image);
+  XpmFreeXpmInfo(&xpm_info);
+
+#else  /* !HAVE_XPM */
+  fprintf(stderr, "%s: not compiled with XPM support.\n", progname);
+  exit (1);
+#endif /* !HAVE_XPM */
+}
+
+
+\f
+/* Computing normal vectors (thanks to Nat Friedman <ndf@mit.edu>)
+ */
+
+typedef struct vector {
+  GLfloat x, y, z;
+} vector;
+
+typedef struct plane {
+  vector p1, p2, p3;
+} plane;
+
+static void
+vector_set(vector *v, GLfloat x, GLfloat y, GLfloat z)
+{
+  v->x = x;
+  v->y = y;
+  v->z = z;
+}
+
+static void
+vector_cross(vector v1, vector v2, vector *v3)
+{
+  v3->x = (v1.y * v2.z) - (v1.z * v2.y);
+  v3->y = (v1.z * v2.x) - (v1.x * v2.z);
+  v3->z = (v1.x * v2.y) - (v1.y * v2.x);
+}
+
+static void
+vector_subtract(vector v1, vector v2, vector *res)
+{
+  res->x = v1.x - v2.x;
+  res->y = v1.y - v2.y;
+  res->z = v1.z - v2.z;
+}
+
+static void
+plane_normal(plane p, vector *n)
+{
+  vector v1, v2;
+  vector_subtract(p.p1, p.p2, &v1);
+  vector_subtract(p.p1, p.p3, &v2);
+  vector_cross(v2, v1, n);
+}
+
+static void
+do_normal(GLfloat x1, GLfloat y1, GLfloat z1,
+         GLfloat x2, GLfloat y2, GLfloat z2,
+         GLfloat x3, GLfloat y3, GLfloat z3)
+{
+  plane plane;
+  vector n;
+  vector_set(&plane.p1, x1, y1, z1);
+  vector_set(&plane.p2, x2, y2, z2);
+  vector_set(&plane.p3, x3, y3, z3);
+  plane_normal(plane, &n);
+  n.x = -n.x; n.y = -n.y; n.z = -n.z;
+
+  glNormal3f(n.x, n.y, n.z);
+
+#ifdef DEBUG
+  /* Draw a line in the direction of this face's normal. */
+  {
+    GLfloat ax = n.x > 0 ? n.x : -n.x;
+    GLfloat ay = n.y > 0 ? n.y : -n.y;
+    GLfloat az = n.z > 0 ? n.z : -n.z;
+    GLfloat mx = (x1 + x2 + x3) / 3;
+    GLfloat my = (y1 + y2 + y3) / 3;
+    GLfloat mz = (z1 + z2 + z3) / 3;
+    GLfloat xx, yy, zz;
+
+    GLfloat max = ax > ay ? ax : ay;
+    if (az > max) max = az;
+    max *= 2;
+    xx = n.x / max;
+    yy = n.y / max;
+    zz = n.z / max;
+
+    glBegin(GL_LINE_LOOP);
+    glVertex3f(mx, my, mz);
+    glVertex3f(mx+xx, my+yy, mz+zz);
+    glEnd();
+  }
+#endif /* DEBUG */
+}
+
+
+\f
+/* Shorthand utilities for making faces, with proper normals.
+ */
+
+static void
+face3(GLint texture, GLfloat *color, Bool wire,
+      GLfloat s1, GLfloat t1, GLfloat x1, GLfloat y1, GLfloat z1,
+      GLfloat s2, GLfloat t2, GLfloat x2, GLfloat y2, GLfloat z2,
+      GLfloat s3, GLfloat t3, GLfloat x3, GLfloat y3, GLfloat z3)
+{
+#ifdef HAVE_GLBINDTEXTURE
+  glBindTexture(GL_TEXTURE_2D, texture);
+#endif /* HAVE_GLBINDTEXTURE */
+  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
+  do_normal(x1, y1, z1,  x2, y2, z2,  x3, y3, z3);
+  glBegin(wire ? GL_LINE_LOOP : GL_TRIANGLES);
+  glTexCoord2f(s1, t1); glVertex3f(x1, y1, z1);
+  glTexCoord2f(s2, t2); glVertex3f(x2, y2, z2);
+  glTexCoord2f(s3, t3); glVertex3f(x3, y3, z3);
+  glEnd();
+}
+
+static void
+face4(GLint texture, GLfloat *color, Bool wire,
+      GLfloat s1, GLfloat t1, GLfloat x1, GLfloat y1, GLfloat z1,
+      GLfloat s2, GLfloat t2, GLfloat x2, GLfloat y2, GLfloat z2,
+      GLfloat s3, GLfloat t3, GLfloat x3, GLfloat y3, GLfloat z3,
+      GLfloat s4, GLfloat t4, GLfloat x4, GLfloat y4, GLfloat z4)
+{
+#ifdef HAVE_GLBINDTEXTURE
+  glBindTexture(GL_TEXTURE_2D, texture);
+#endif /* HAVE_GLBINDTEXTURE */
+  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
+  do_normal(x1, y1, z1,  x2, y2, z2,  x3, y3, z3);
+  glBegin(wire ? GL_LINE_LOOP : GL_QUADS);
+  glTexCoord2f(s1, t1); glVertex3f(x1, y1, z1);
+  glTexCoord2f(s2, t2); glVertex3f(x2, y2, z2);
+  glTexCoord2f(s3, t3); glVertex3f(x3, y3, z3);
+  glTexCoord2f(s4, t4); glVertex3f(x4, y4, z4);
+  glEnd();
+}
+
+static void
+face5(GLint texture, GLfloat *color, Bool wire,
+      GLfloat s1, GLfloat t1, GLfloat x1, GLfloat y1, GLfloat z1,
+      GLfloat s2, GLfloat t2, GLfloat x2, GLfloat y2, GLfloat z2,
+      GLfloat s3, GLfloat t3, GLfloat x3, GLfloat y3, GLfloat z3,
+      GLfloat s4, GLfloat t4, GLfloat x4, GLfloat y4, GLfloat z4,
+      GLfloat s5, GLfloat t5, GLfloat x5, GLfloat y5, GLfloat z5)
+{
+#ifdef HAVE_GLBINDTEXTURE
+  glBindTexture(GL_TEXTURE_2D, texture);
+#endif /* HAVE_GLBINDTEXTURE */
+  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, color);
+  do_normal(x1, y1, z1,  x2, y2, z2,  x3, y3, z3);
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  glTexCoord2f(s1, t1); glVertex3f(x1, y1, z1);
+  glTexCoord2f(s2, t2); glVertex3f(x2, y2, z2);
+  glTexCoord2f(s3, t3); glVertex3f(x3, y3, z3);
+  glTexCoord2f(s4, t4); glVertex3f(x4, y4, z4);
+  glTexCoord2f(s5, t5); glVertex3f(x5, y5, z5);
+  glEnd();
+}
+
+
+\f
+/* Creating object models
+ */
+
+static void
+box(ModeInfo *mi, Bool wire)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+
+  glNewList(lc->box, GL_COMPILE);
+  glShadeModel(GL_SMOOTH);
+
+  /* N */
+  face4(lc->texids[FACE_N], exterior_color, wire,
+       0.0, 0.0,       -0.5,  0.5,  0.5,
+       1.0, 0.0,        0.5,  0.5,  0.5,
+       1.0, 1.0,        0.5,  0.5, -0.5,
+       0.0, 1.0,       -0.5,  0.5, -0.5);
+
+  /* S */
+  face4(lc->texids[FACE_S], exterior_color, wire,
+       0.0, 0.0,        -0.5, -0.5, -0.5,
+       1.0, 0.0,         0.5, -0.5, -0.5,
+       1.0, 1.0,         0.5, -0.5,  0.5,
+       0.0, 1.0,        -0.5, -0.5,  0.5);
+
+  /* E */
+  face4(lc->texids[FACE_E], exterior_color, wire,
+       0.0, 0.0,        0.5, -0.5, -0.5,
+       1.0, 0.0,        0.5,  0.5, -0.5,
+       1.0, 1.0,        0.5,  0.5,  0.5,
+       0.0, 1.0,        0.5, -0.5,  0.5);
+
+  /* W */
+  face4(lc->texids[FACE_W], exterior_color, wire,
+       1.0, 1.0,       -0.5, -0.5,  0.5,
+       0.0, 1.0,       -0.5,  0.5,  0.5,
+       0.0, 0.0,       -0.5,  0.5, -0.5,
+       1.0, 0.0,       -0.5, -0.5, -0.5);
+
+  /* U */
+  face4(lc->texids[FACE_U], exterior_color, wire,
+       1.0, 0.0,        0.5, -0.5,  0.5,
+       1.0, 1.0,        0.5,  0.5,  0.5,
+       0.0, 1.0,       -0.5,  0.5,  0.5,
+       0.0, 0.0,       -0.5, -0.5,  0.5);
+
+  /* D */
+  face4(lc->texids[FACE_D], exterior_color, wire,
+       0.0, 1.0,       -0.5, -0.5, -0.5,
+       0.0, 0.0,       -0.5,  0.5, -0.5,
+       1.0, 0.0,        0.5,  0.5, -0.5,
+       1.0, 1.0,        0.5, -0.5, -0.5);
+
+  glEndList();
+}
+
+
+static void
+star(ModeInfo *mi, Bool top, Bool wire)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  int i;
+
+  int points[][2] = {
+    {  77,  74 }, {  60,  98 }, {   0,  71 }, {   0,   0 },    /* L1 */
+    {  60,  98 }, {  55, 127 }, {   0, 127 }, {   0,  71 },    /* L2 */
+    {  55, 127 }, {  60, 154 }, {   0, 179 }, {   0, 127 },    /* L3 */
+    {  60, 154 }, {  76, 176 }, {   0, 255 }, {   0, 179 },    /* L4 */
+    {  76, 176 }, { 100, 193 }, {  74, 255 }, {   0, 255 },    /* B1 */
+    { 100, 193 }, { 127, 198 }, { 127, 255 }, {  74, 255 },    /* B2 */
+    { 127, 198 }, { 151, 193 }, { 180, 255 }, { 127, 255 },    /* B3 */
+    { 151, 193 }, { 178, 177 }, { 255, 255 }, { 180, 255 },    /* B4 */
+    { 178, 177 }, { 193, 155 }, { 255, 181 }, { 255, 255 },    /* R4 */
+    { 193, 155 }, { 199, 127 }, { 255, 127 }, { 255, 181 },    /* R3 */
+    { 199, 127 }, { 194,  99 }, { 255,  74 }, { 255, 127 },    /* R2 */
+    { 194,  99 }, { 179,  76 }, { 255,   0 }, { 255,  74 },    /* R1 */
+    { 179,  76 }, { 155,  60 }, { 180,   0 }, { 255,   0 },    /* T4 */
+    { 155,  60 }, { 126,  55 }, { 126,   0 }, { 180,   0 },    /* T3 */
+    { 126,  55 }, { 100,  60 }, {  75,   0 }, { 126,   0 },    /* T2 */
+    { 100,  60 }, {  77,  74 }, {   0,   0 }, {  75,   0 },    /* T1 */
+  };
+
+  for (i = 0; i < countof(points); i++)
+    points[i][1] = 255-points[i][1];
+
+  if (top)
+    glNewList(lc->star1, GL_COMPILE);
+  else
+    glNewList(lc->star2, GL_COMPILE);
+
+  if (!top)
+    glRotatef(-180.0, 1.0, 0.0, 0.0);
+
+  for (i = 0; i < countof(points)/4; i += 2)
+    {
+      int j, k;
+
+      /* Top face.
+       */
+
+      GLfloat s[4], t[4], x[4], y[4], z[4];
+      for (j = 3, k = 0; j >= 0; j--, k++)
+       {
+         GLfloat xx = points[(i*4)+j][0] / 255.0L;
+         GLfloat yy = points[(i*4)+j][1] / 255.0L;
+         s[k] = xx;
+         t[k] = yy;
+         x[k] = xx-0.5;
+         y[k] = yy-0.5;
+         z[k] = 0.5;
+       }
+      face4(lc->texids[top ? FACE_U : FACE_D], exterior_color, wire,
+           s[0], t[0],  x[0], y[0], z[0],
+           s[1], t[1],  x[1], y[1], z[1],
+           s[2], t[2],  x[2], y[2], z[2],
+           s[3], t[3],  x[3], y[3], z[3]);
+
+      /* Bottom face.
+       */
+      for (j = 0, k = 0; j < 4; j++, k++)
+       {
+         GLfloat xx = points[(i*4)+j][0] / 255.0L;
+         GLfloat yy = points[(i*4)+j][1] / 255.0L;
+         s[k] = xx;
+         t[k] = 1.0 - yy;
+         x[k] = xx-0.5;
+         y[k] = yy-0.5;
+         z[k] = -0.5;
+       }
+      face4(lc->texids[top ? FACE_U : FACE_D], exterior_color, wire,
+           s[0], t[0],  x[0], y[0], z[0],
+           s[1], t[1],  x[1], y[1], z[1],
+           s[2], t[2],  x[2], y[2], z[2],
+           s[3], t[3],  x[3], y[3], z[3]);
+
+      /* Connecting faces.
+       */
+      for (j = 3; j >= 0; j--)
+       {
+         int k = (j == 0 ? 3 : j-1);
+         Bool front_p = (j == 3);
+         GLfloat x1 = points[(i*4)+j][0] / 255.0L;
+         GLfloat y1 = points[(i*4)+j][1] / 255.0L;
+         GLfloat x2 = points[(i*4)+k][0] / 255.0L;
+         GLfloat y2 = points[(i*4)+k][1] / 255.0L;
+
+         GLfloat tx1=0.0, tx2=1.0, ty1=0.0, ty2=1.0;
+
+         int texture = 0;
+         int facing = i/4;
+         facing = (facing + j + 5) % 4;
+
+         switch (facing) {
+         case 0:
+           texture = FACE_W;
+           if (top) {
+             tx1 = 1.0 - y1;  tx2 = 1.0 - y2;
+             ty1 = 0.0;       ty2 = 1.0;
+           } else {
+             tx1 = y1;  tx2 = y2;
+             ty1 = 1.0; ty2 = 0.0;
+           }
+           break;
+         case 1:
+           texture = top ? FACE_S : FACE_N;
+           tx1 = x1;  tx2 = x2;
+           ty1 = 0.0; ty2 = 1.0;
+           break;
+         case 2:
+           texture = FACE_E;
+           if (top) {
+             tx1 = y1;  tx2 = y2;
+             ty1 = 0.0; ty2 = 1.0;
+           } else {
+             tx1 = 1.0 - y1;  tx2 = 1.0 - y2;
+             ty1 = 1.0;       ty2 = 0.0;
+           }
+           break;
+         case 3:
+           texture = top ? FACE_N : FACE_S;
+           tx1 = x1;  tx2 = x2;
+           ty1 = 1.0; ty2 = 0.0;
+           break;
+         }
+
+         x1 -= 0.5; x2 -= 0.5;
+         y1 -= 0.5; y2 -= 0.5;
+
+         face4(front_p ? lc->texids[texture] : 0,
+               front_p ? exterior_color : interior_color,
+               wire,
+               tx1, ty2,  x1, y1,  0.5,
+               tx1, ty1,  x1, y1, -0.5,
+               tx2, ty1,  x2, y2, -0.5,
+               tx2, ty2,  x2, y2,  0.5);
+       }
+    }
+
+
+  /* Central core top cap.
+   */
+#ifdef HAVE_GLBINDTEXTURE
+  glBindTexture(GL_TEXTURE_2D, lc->texids[top ? FACE_U : FACE_D]);
+#endif /* HAVE_GLBINDTEXTURE */
+  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+
+  i = 1;
+  do_normal(points[i+0][0], points[i+0][1], 0,
+           points[i+4][0], points[i+4][1], 0,
+           points[i+8][0], points[i+8][1], 0);
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  for (i = 1; i < countof(points); i += 4)
+    {
+      GLfloat x = points[i][0] / 255.0L;
+      GLfloat y = points[i][1] / 255.0L;
+      glTexCoord2f(x, y);
+      glVertex3f(x-0.5, y-0.5, 0.5);
+    }
+  glEnd();
+
+
+  /* Central core bottom cap.
+   */
+#ifdef HAVE_GLBINDTEXTURE
+  glBindTexture(GL_TEXTURE_2D, 0);
+#endif /* HAVE_GLBINDTEXTURE */
+  glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, interior_color);
+
+  i = countof(points) - 3;
+  do_normal(points[i+0][0], points[i+0][1], 0,
+           points[i+4][0], points[i+4][1], 0,
+           points[i+8][0], points[i+8][1], 0);
+
+  glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+  for (i = countof(points) - 3; i >= 0; i -= 4)
+    {
+      GLfloat x = points[i][0] / 255.0L;
+      GLfloat y = points[i][1] / 255.0L;
+      glVertex3f(x-0.5, y-0.5, 0);
+    }
+  glEnd();
+  
+
+  /* Central core walls.
+   */
+  for (i = 1; i < countof(points); i += 4)
+    {
+
+      GLfloat x1 = points[i-1][0] / 255.0L;
+      GLfloat y1 = points[i-1][1] / 255.0L;
+      GLfloat x2 = points[i][0] / 255.0L;
+      GLfloat y2 = points[i][1] / 255.0L;
+      face4(0, interior_color, wire,
+           0.0, 0.0,  x1-0.5, y1-0.5, 0.5,
+           0.0, 0.0,  x1-0.5, y1-0.5, 0.0,
+           0.0, 0.0,  x2-0.5, y2-0.5, 0.0,
+           0.0, 0.0,  x2-0.5, y2-0.5, 0.5);
+    }
+
+  glEndList();
+}
+
+
+static void
+tetra(ModeInfo *mi, Bool wire)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+
+  glNewList(lc->tetra_une, GL_COMPILE);
+  {
+    glShadeModel(GL_SMOOTH);
+
+    /* Ua */
+    face3(lc->texids[FACE_U], exterior_color, wire,
+         1.0, 0.0,      0.5, -0.5,  0.5,
+         1.0, 1.0,      0.5,  0.5,  0.5,
+         0.0, 1.0,     -0.5,  0.5,  0.5);
+
+    /* Na */
+    face3(lc->texids[FACE_N], exterior_color, wire,
+         0.0, 0.0,     -0.5,  0.5,  0.5,
+         1.0, 0.0,      0.5,  0.5,  0.5,
+         1.0, 1.0,      0.5,  0.5, -0.5);
+
+    /* Eb */
+    face3(lc->texids[FACE_E], exterior_color, wire,
+         1.0, 0.0,      0.5,  0.5, -0.5,
+         1.0, 1.0,      0.5,  0.5,  0.5,
+         0.0, 1.0,      0.5, -0.5,  0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,     -0.5,  0.5,  0.5);
+  }
+  glEndList();
+
+  glNewList(lc->tetra_usw, GL_COMPILE);
+  {
+    /* Ub */
+    face3(lc->texids[FACE_U], exterior_color, wire,
+         0.0, 1.0,     -0.5,  0.5,  0.5,
+         0.0, 0.0,     -0.5, -0.5,  0.5,
+         1.0, 0.0,      0.5, -0.5,  0.5);
+
+    /* Sb */
+    face3(lc->texids[FACE_S], exterior_color, wire,
+         1.0, 1.0,      0.5, -0.5,  0.5,
+         0.0, 1.0,     -0.5, -0.5,  0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+
+    /* Wb */
+    face3(lc->texids[FACE_W], exterior_color, wire,
+         1.0, 0.0,     -0.5, -0.5, -0.5,
+         1.0, 1.0,     -0.5, -0.5,  0.5,
+         0.0, 1.0,     -0.5,  0.5,  0.5);
+
+    face3(0, interior_color, wire,
+         0.0,0.0,      -0.5, -0.5, -0.5,
+         0.0,0.0,      -0.5,  0.5,  0.5,
+         0.0,0.0,       0.5, -0.5,  0.5);
+  }
+  glEndList();
+
+  glNewList(lc->tetra_dwn, GL_COMPILE);
+  {
+    /* Db */
+    face3(lc->texids[FACE_D], exterior_color, wire,
+         0.0, 1.0,     -0.5, -0.5, -0.5,
+         0.0, 0.0,     -0.5,  0.5, -0.5,
+         1.0, 0.0,      0.5,  0.5, -0.5);
+
+    /* Wa */
+    face3(lc->texids[FACE_W], exterior_color, wire,
+         0.0, 1.0,     -0.5,  0.5,  0.5,
+         0.0, 0.0,     -0.5,  0.5, -0.5,
+         1.0, 0.0,     -0.5, -0.5, -0.5);
+
+    /* Nb */
+    face3(lc->texids[FACE_N], exterior_color, wire,
+         1.0, 1.0,      0.5,  0.5, -0.5,
+         0.0, 1.0,     -0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5,  0.5,  0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5,  0.5,  0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+  }
+  glEndList();
+
+  glNewList(lc->tetra_dse, GL_COMPILE);
+  {
+    /* Sa */
+    face3(lc->texids[FACE_S], exterior_color, wire,
+         0.0, 0.0,     -0.5, -0.5, -0.5,
+         1.0, 0.0,      0.5, -0.5, -0.5,
+         1.0, 1.0,      0.5, -0.5,  0.5);
+
+    /* Ea */
+    face3(lc->texids[FACE_E], exterior_color, wire,
+         0.0, 1.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,      0.5, -0.5, -0.5,
+         1.0, 0.0,      0.5,  0.5, -0.5);
+
+    /* Da */
+    face3(lc->texids[FACE_D], exterior_color, wire,
+         1.0, 0.0,      0.5,  0.5, -0.5,
+         1.0, 1.0,      0.5, -0.5, -0.5,
+         0.0, 1.0,     -0.5, -0.5, -0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+    glEnd();
+  }
+  glEndList();
+
+  glNewList(lc->tetra_mid, GL_COMPILE);
+  {
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5,  0.5,  0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,     -0.5,  0.5,  0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5,
+         0.0, 0.0,      0.5, -0.5,  0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,     -0.5,  0.5,  0.5,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+
+    face3(0, interior_color, wire,
+         0.0, 0.0,      0.5, -0.5,  0.5,
+         0.0, 0.0,      0.5,  0.5, -0.5,
+         0.0, 0.0,     -0.5, -0.5, -0.5);
+  }
+  glEndList();
+
+}
+
+static void
+lid(ModeInfo *mi, Bool wire)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  int i;
+
+  int points[][2] = {
+    { 128,  20 },{  21, 129 },{   0, 129 },{   0,   0 },{ 128,   0 }, /* L1 */
+    {  21, 129 },{ 127, 234 },{ 127, 255 },{   0, 255 },{   0, 129 }, /* L2 */
+    { 127, 234 },{ 233, 127 },{ 255, 127 },{ 255, 255 },{ 127, 255 }, /* R2 */
+    { 233, 127 },{ 128,  20 },{ 128,   0 },{ 255,   0 },{ 255, 127 }, /* R1 */
+  };
+
+  for (i = 0; i < countof(points); i++)
+    points[i][1] = 255-points[i][1];
+
+  glNewList(lc->lid_0, GL_COMPILE);
+  glShadeModel(GL_SMOOTH);
+
+  /* N */
+  face4(lc->texids[FACE_N], exterior_color, wire,
+       0.0, 0.0,       -0.5,  0.5,  0.5,
+       1.0, 0.0,        0.5,  0.5,  0.5,
+       1.0, 1.0,        0.5,  0.5, -0.5,
+       0.0, 1.0,       -0.5,  0.5, -0.5);
+
+  /* S */
+  face4(lc->texids[FACE_S], exterior_color, wire,
+       0.0, 0.0,       -0.5, -0.5, -0.5,
+       1.0, 0.0,        0.5, -0.5, -0.5,
+       1.0, 1.0,        0.5, -0.5,  0.5,
+       0.0, 1.0,       -0.5, -0.5,  0.5);
+
+  /* E */
+  face4(lc->texids[FACE_E], exterior_color, wire,
+       0.0, 0.0,        0.5, -0.5, -0.5,
+       1.0, 0.0,        0.5,  0.5, -0.5,
+       1.0, 1.0,        0.5,  0.5,  0.5,
+       0.0, 1.0,        0.5, -0.5,  0.5);
+
+  /* U */
+  face4(lc->texids[FACE_U], exterior_color, wire,
+       1.0, 0.0,        0.5, -0.5,  0.5,
+       1.0, 1.0,        0.5,  0.5,  0.5,
+       0.0, 1.0,       -0.5,  0.5,  0.5,
+       0.0, 0.0,       -0.5, -0.5,  0.5);
+
+  /* D */
+  face4(lc->texids[FACE_D], exterior_color, wire,
+       0.0, 1.0,       -0.5, -0.5, -0.5,
+       0.0, 0.0,       -0.5,  0.5, -0.5,
+       1.0, 0.0,        0.5,  0.5, -0.5,
+       1.0, 1.0,        0.5, -0.5, -0.5);
+
+  /* W -- lid_0 */
+  for (i = 0; i < countof(points)/5; i++)
+    {
+      int j;
+      GLfloat s[5], t[5], x[5], y[5], z[5];
+      for (j = 0; j < 5; j++)
+       {
+         GLfloat xx = points[(i*5)+j][0] / 255.0L;
+         GLfloat yy = points[(i*5)+j][1] / 255.0L;
+         s[j] = 1.0-xx;
+         t[j] = yy;
+         x[j] = -0.5;
+         y[j] = xx-0.5;
+         z[j] = yy-0.5;
+       }
+      face5(lc->texids[FACE_W], exterior_color, wire,
+           s[0], t[0],  x[0], y[0], z[0],
+           s[1], t[1],  x[1], y[1], z[1],
+           s[2], t[2],  x[2], y[2], z[2],
+           s[3], t[3],  x[3], y[3], z[3],
+           s[4], t[4],  x[4], y[4], z[4]);
+    }
+  glEndList();
+
+
+  /* W -- lid_1 through lid_4 */
+  for (i = 0; i < 4; i++)
+    {
+      GLfloat x1, y1, x2, y2, x3, y3;
+
+      glNewList(lc->lid_1 + i, GL_COMPILE);
+      glShadeModel(GL_SMOOTH);
+
+      x1 = points[(i*5)+1][0] / 255.0L;
+      y1 = points[(i*5)+1][1] / 255.0L;
+      x2 = points[(i*5)][0] / 255.0L;
+      y2 = points[(i*5)][1] / 255.0L;
+      x3 = 0.5;
+      y3 = 0.5;
+
+      /* Outer surface */
+      face3(lc->texids[FACE_W], exterior_color, wire,
+           1.0-x1, y1,         -0.5, x1-0.5, y1-0.5,
+           1.0-x2, y2,         -0.5, x2-0.5, y2-0.5,
+           1.0-x3, y3,         -0.5, x3-0.5, y3-0.5);
+
+      /* Inner surface */
+      face3(0, interior_color, wire,
+           0.0, 0.0,   -0.48, x2-0.5, y2-0.5,
+           0.0, 0.0,   -0.48, x1-0.5, y1-0.5,
+           0.0, 0.0,   -0.48, x3-0.5, y3-0.5);
+
+      /* Lip 1 */
+      face4(0, interior_color, wire,
+           0.0, 0.0,   -0.5,  x1-0.5, y1-0.5,
+           0.0, 0.0,   -0.5,  x3-0.5, y3-0.5,
+           0.0, 0.0,   -0.48, x3-0.5, y3-0.5,
+           0.0, 0.0,   -0.48, x1-0.5, y1-0.5);
+
+      /* Lip 2 */
+      face4(0, interior_color, wire,
+           0.0, 0.0,   -0.48, x2-0.5, y2-0.5,
+           0.0, 0.0,   -0.48, x3-0.5, y3-0.5,
+           0.0, 0.0,   -0.5,  x3-0.5, y3-0.5,
+           0.0, 0.0,   -0.5,  x2-0.5, y2-0.5);
+
+      glEndList();
+    }
+}
+
+static void
+taser(ModeInfo *mi, Bool wire)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  int i;
+
+  int slider_face_points[][2] = {
+    {  86,  58 },{  38, 106 },{  70, 106 },{ 118,  58 },{  -1,  -1 }, /* a */
+    { 136,  58 },{ 184, 106 },{ 216, 106 },{ 168,  58 },{  -1,  -1 }, /* b */
+    {  38, 106 },{   0, 144 },{   0, 190 },{  60, 190 },{ 108, 106 }, /* c */
+    { 144, 106 },{ 194, 190 },{ 254, 190 },{ 254, 144 },{ 216, 106 }, /* d */
+    {  98, 124 },{  60, 190 },{  92, 190 },{ 126, 158 },{ 126, 124 }, /* e */
+    { 126, 124 },{ 126, 158 },{ 160, 190 },{ 194, 190 },{ 154, 124 }, /* f */
+    {  22, 190 },{  22, 254 },{  60, 254 },{  60, 190 },{  -1,  -1 }, /* g */
+    { 194, 190 },{ 194, 254 },{ 230, 254 },{ 230, 190 },{  -1,  -1 }, /* h */
+    {  60, 190 },{  60, 210 },{  92, 210 },{  92, 190 },{  -1,  -1 }, /* i */
+    { 160, 190 },{ 160, 210 },{ 194, 210 },{ 194, 190 },{  -1,  -1 }, /* j */
+    { 110, 172 },{  92, 190 },{ 110, 190 },{  -1,  -1 },{  -1,  -1 }, /* k */
+    { 140, 172 },{ 140, 190 },{ 160, 190 },{  -1,  -1 },{  -1,  -1 }, /* l */
+    { 110, 172 },{ 140, 172 },{ 126, 156 },{  -1,  -1 },{  -1,  -1 }, /* m */
+  };
+
+  int body_face_points[][2] = {
+    {   0,   0 },{   0,  58 },{ 254,  58 },{ 254,   0 },{  -1,  -1 }, /* A */
+    {   0,  58 },{   0, 144 },{  86,  58 },{  -1,  -1 },{  -1,  -1 }, /* B */
+    { 168,  58 },{ 254, 144 },{ 254,  58 },{  -1,  -1 },{  -1,  -1 }, /* C */
+    { 118,  58 },{  70, 106 },{ 184, 106 },{ 136,  58 },{  -1,  -1 }, /* F */
+    { 108, 106 },{  98, 124 },{ 154, 124 },{ 144, 106 },{  -1,  -1 }, /* G */
+  };
+
+  int lifter_face_points[][2] = {
+    {   0, 190 },{   0, 254 },{  22, 254 },{  22, 190 },{  -1,  -1 }, /* D */
+    { 230, 190 },{ 230, 254 },{ 254, 254 },{ 254, 190 },{  -1,  -1 }, /* E */
+    {  60, 210 },{  60, 254 },{ 194, 254 },{ 194, 210 },{  -1,  -1 }, /* H */
+    {  92, 190 },{  92, 210 },{ 160, 210 },{ 160, 190 },{  -1,  -1 }, /* I */
+    { 110, 172 },{ 110, 190 },{ 140, 190 },{ 140, 172 },{  -1,  -1 }, /* J */
+  };
+
+  int body_perimiter_points[][2] = {
+    {   0, 144 },{  86,  59 },{ 119,  58 },{  71, 107 },
+    { 108, 107 },{  98, 124 },{ 155, 124 },{ 144, 107 },
+    { 185, 106 },{ 136,  59 },{ 169,  59 },{ 255, 145 },
+    { 255,   0 },{   0,   0 },
+  };
+
+  int slider_perimiter_points[][2] = {
+    {  86,  58 },{   0,  144 },{   0, 190 },{  22,  190 },{  22, 254 },
+    {  60, 254 },{  60,  210 },{  92, 210 },{  92,  190 },{ 110, 190 },
+    { 110, 172 },{  140, 172 },{ 140, 190 },{ 160,  190 },{ 160, 210 },
+    { 194, 210 },{  194, 254 },{ 230, 254 },{ 230,  190 },{ 254, 190 },
+    { 254, 144 },{  168,  58 },{ 136,  58 },{ 184,  106 },{ 144, 106 },
+    { 154, 124 },{  98,  124 },{ 108, 106 },{  70,  106 },{ 118,  58 },
+  };
+
+  int lifter_perimiter_points_1[][2] = {
+    {   0, 189 },{   0, 254 },{  22, 255 },{  23, 190 },
+  };
+
+  int lifter_perimiter_points_2[][2] = {
+    { 230, 254 },{ 255, 255 },{ 254, 190 },{ 230, 190 },
+  };
+
+  int lifter_perimiter_points_3[][2] = {
+    {  60, 254 },{ 194, 254 },{ 194, 211 },{ 160, 210 },
+    { 160, 190 },{ 140, 191 },{ 141, 172 },{ 111, 172 },
+    { 110, 190 },{ 93, 190 },{ 92, 210 },{ 60, 211 },
+  };
+
+  for (i = 0; i < countof(slider_face_points); i++)
+    slider_face_points[i][1] = 255-slider_face_points[i][1];
+  for (i = 0; i < countof(body_face_points); i++)
+    body_face_points[i][1] = 255-body_face_points[i][1];
+  for (i = 0; i < countof(lifter_face_points); i++)
+    lifter_face_points[i][1] = 255-lifter_face_points[i][1];
+  for (i = 0; i < countof(body_perimiter_points); i++)
+    body_perimiter_points[i][1] = 255-body_perimiter_points[i][1];
+  for (i = 0; i < countof(slider_perimiter_points); i++)
+    slider_perimiter_points[i][1] = 255-slider_perimiter_points[i][1];
+  for (i = 0; i < countof(lifter_perimiter_points_1); i++)
+    lifter_perimiter_points_1[i][1] = 255-lifter_perimiter_points_1[i][1];
+  for (i = 0; i < countof(lifter_perimiter_points_2); i++)
+    lifter_perimiter_points_2[i][1] = 255-lifter_perimiter_points_2[i][1];
+  for (i = 0; i < countof(lifter_perimiter_points_3); i++)
+    lifter_perimiter_points_3[i][1] = 255-lifter_perimiter_points_3[i][1];
+
+  /* -------------------------------------------------------------------- */
+
+  glNewList(lc->taser_base, GL_COMPILE);
+  glShadeModel(GL_SMOOTH);
+
+  /* N */
+  face4(lc->texids[FACE_N], exterior_color, wire,
+       0.0, 0.0,       -0.5,  0.5,  0.5,
+       0.75, 0.0,       0.25, 0.5,  0.5,
+       0.75, 0.75,      0.25, 0.5, -0.25,
+       0.0, 0.75,      -0.5,  0.5, -0.25);
+
+  /* S */
+  face4(lc->texids[FACE_S], exterior_color, wire,
+       0.0,  0.25,     -0.5,  -0.5, -0.25,
+       0.75, 0.25,      0.25, -0.5, -0.25,
+       0.75, 1.0,       0.25, -0.5,  0.5,
+       0.0,  1.0,      -0.5,  -0.5,  0.5);
+
+  /* interior E */
+  face4(0, interior_color, wire,
+       0.0, 0.0,        0.25, -0.5, -0.25,
+       1.0, 0.0,        0.25,  0.5, -0.25,
+       1.0, 1.0,        0.25,  0.5,  0.5,
+       0.0, 1.0,        0.25, -0.5,  0.5);
+
+  /* W */
+  face4(lc->texids[FACE_W], exterior_color, wire,
+       1.0, 1.0,       -0.5, -0.5,  0.5,
+       0.0, 1.0,       -0.5,  0.5,  0.5,
+       0.0, 0.25,      -0.5,  0.5, -0.25,
+       1.0, 0.25,      -0.5, -0.5, -0.25);
+
+  /* U */
+  face4(lc->texids[FACE_U], exterior_color, wire,
+       0.75, 0.0,       0.25, -0.5,  0.5,
+       0.75, 1.0,       0.25,  0.5,  0.5,
+       0.0, 1.0,       -0.5,   0.5,  0.5,
+       0.0, 0.0,       -0.5,  -0.5,  0.5);
+
+  /* interior D */
+  face4(0, interior_color, wire,
+       0.0, 1.0,       -0.5,  -0.5, -0.25,
+       0.0, 0.0,       -0.5,   0.5, -0.25,
+       1.0, 0.0,        0.25,  0.5, -0.25,
+       1.0, 1.0,        0.25, -0.5, -0.25);
+
+  /* Top face */
+  for (i = 0; i < countof(body_face_points)/5; i++)
+    {
+      int j;
+#ifdef HAVE_GLBINDTEXTURE
+      glBindTexture(GL_TEXTURE_2D, lc->texids[FACE_E]);
+#endif /* HAVE_GLBINDTEXTURE */
+      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+
+      do_normal(0, body_face_points[(i*5)+0][0], body_face_points[(i*5)+0][1],
+               0, body_face_points[(i*5)+1][0], body_face_points[(i*5)+1][1],
+               0, body_face_points[(i*5)+2][0], body_face_points[(i*5)+2][1]
+               );
+      glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+      for (j = 0; j < 5; j++)
+       {
+         int ix = body_face_points[(i*5)+j][0];
+         int iy = body_face_points[(i*5)+j][1];
+         GLfloat x, y;
+         if (ix == -1)  /* these are padding: ignore them */
+           continue;
+         x = ix / 255.0L;
+         y = iy / 255.0L;
+         glTexCoord2f(x, y);
+         glVertex3f(0.5, x-0.5, y-0.5);
+       }
+      glEnd();
+    }
+
+  /* Side walls */
+  for (i = 0; i < countof(body_perimiter_points); i++)
+    {
+      int j = (i+1 >= countof(body_perimiter_points) ? 0 : i+1);
+      GLfloat x1 = body_perimiter_points[i][0] / 255.0;
+      GLfloat y1 = body_perimiter_points[i][1] / 255.0;
+      GLfloat x2 = body_perimiter_points[j][0] / 255.0;
+      GLfloat y2 = body_perimiter_points[j][1] / 255.0;
+      int texture = -1;
+      GLfloat s1=0, t1=0, s2=0, t2=0, s3=0, t3=0, s4=0, t4=0;
+
+      if (i == 11)
+       {
+         texture = lc->texids[FACE_N];
+         s1 = 1.0;  t1 = 0.0;
+         s2 = 1.0;  t2 = 0.568;
+         s3 = 0.75, t3 = 0.568;
+         s4 = 0.75; t4 = 0.0;
+       }
+      else if (i == 12)
+       {
+         texture = lc->texids[FACE_U];
+         s1 = 1.0;  t1 = 0.0;
+         s2 = 1.0;  t2 = 1.0;
+         s3 = 0.75, t3 = 1.0;
+         s4 = 0.75; t4 = 0.0;
+       }
+      else if (i == 13)
+       {
+         texture = lc->texids[FACE_S];
+         s1 = 1.0;  t1 = 0.437;
+         s2 = 1.0;  t2 = 1.0;
+         s3 = 0.75; t3 = 1.0;
+         s4 = 0.75; t4 = 0.437;
+       }
+
+      face4((texture == -1 ? 0 : texture),
+           (texture == -1 ? interior_color : exterior_color),
+           wire,
+           s1, t1,  0.5,  x2-0.5, y2-0.5,
+           s2, t2,  0.5,  x1-0.5, y1-0.5,
+           s3, t3,  0.25, x1-0.5, y1-0.5,
+           s4, t4,  0.25, x2-0.5, y2-0.5);
+    }
+
+  glEndList();
+
+  /* -------------------------------------------------------------------- */
+
+  glNewList(lc->taser_lifter, GL_COMPILE);
+  glShadeModel(GL_SMOOTH);
+
+  /* N */
+  face4(lc->texids[FACE_N], exterior_color, wire,
+       0.0,  0.75,     -0.5,  0.5, -0.25,
+       0.75, 0.75,      0.25, 0.5, -0.25,
+       0.75, 1.0,       0.25, 0.5, -0.5,
+       0.0,  1.0,      -0.5,  0.5, -0.5);
+
+  /* S */
+  face4(lc->texids[FACE_S], exterior_color, wire,
+       0.0,  0.0,      -0.5,  -0.5, -0.5,
+       0.75, 0.0,       0.25, -0.5, -0.5,
+       0.75, 0.25,      0.25, -0.5, -0.25,
+       0.0,  0.25,     -0.5,  -0.5, -0.25);
+
+  /* interior E */
+  face4(0, interior_color, wire,
+       0.0, 1.0,        0.25, -0.5, -0.5,
+       1.0, 1.0,        0.25,  0.5, -0.5,
+       1.0, 0.0,        0.25,  0.5, -0.25,
+       0.0, 0.0,        0.25, -0.5, -0.25);
+
+  /* W */
+  face4(lc->texids[FACE_W], exterior_color, wire,
+       1.0, 0.25,      -0.5, -0.5, -0.25,
+       0.0, 0.25,      -0.5,  0.5, -0.25,
+       0.0, 0.0,       -0.5,  0.5, -0.5,
+       1.0, 0.0,       -0.5, -0.5, -0.5);
+
+  /* interior U */
+  face4(0, interior_color, wire,
+       1.0, 0.0,        0.25, -0.5,  -0.25,
+       1.0, 1.0,        0.25,  0.5,  -0.25,
+       0.0, 1.0,       -0.5,   0.5,  -0.25,
+       0.0, 0.0,       -0.5,  -0.5,  -0.25);
+
+  /* D */
+  face4(lc->texids[FACE_D], exterior_color, wire,
+       0.0, 1.0,       -0.5, -0.5, -0.5,
+       0.0, 0.0,       -0.5,  0.5, -0.5,
+       0.75, 0.0,       0.25,  0.5, -0.5,
+       0.75, 1.0,       0.25, -0.5, -0.5);
+
+
+  /* Top face */
+  for (i = 0; i < countof(lifter_face_points)/5; i++)
+    {
+      int j;
+
+#ifdef HAVE_GLBINDTEXTURE
+      glBindTexture(GL_TEXTURE_2D, lc->texids[FACE_E]);
+#endif /* HAVE_GLBINDTEXTURE */
+      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+
+      do_normal(
+         0, lifter_face_points[(i*5)+0][0], lifter_face_points[(i*5)+0][1],
+        0, lifter_face_points[(i*5)+1][0], lifter_face_points[(i*5)+1][1],
+        0, lifter_face_points[(i*5)+2][0], lifter_face_points[(i*5)+2][1]);
+
+      glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+      for (j = 0; j < 5; j++)
+       {
+         int ix = lifter_face_points[(i*5)+j][0];
+         int iy = lifter_face_points[(i*5)+j][1];
+         GLfloat x, y;
+         if (ix == -1)  /* these are padding: ignore them */
+           continue;
+         x = ix / 255.0L;
+         y = iy / 255.0L;
+         glTexCoord2f(x, y);
+         glVertex3f(0.5, x-0.5, y-0.5);
+       }
+      glEnd();
+    }
+
+  /* Side walls */
+  for (i = 0; i < countof(lifter_perimiter_points_1); i++)
+    {
+      int j = (i+1 >= countof(lifter_perimiter_points_1) ? 0 : i+1);
+      GLfloat x1 = lifter_perimiter_points_1[i][0] / 255.0;
+      GLfloat y1 = lifter_perimiter_points_1[i][1] / 255.0;
+      GLfloat x2 = lifter_perimiter_points_1[j][0] / 255.0;
+      GLfloat y2 = lifter_perimiter_points_1[j][1] / 255.0;
+      int texture = -1;
+      GLfloat s1=0, t1=0, s2=0, t2=0, s3=0, t3=0, s4=0, t4=0;
+
+      if (i == 0)
+       {
+         texture = lc->texids[FACE_S];
+         s1 = 1.0;  t1 = 0.0;
+         s2 = 1.0;  t2 = 0.26;
+         s3 = 0.75, t3 = 0.26;
+         s4 = 0.75; t4 = 0.0;
+       }
+      else if (i == 1)
+       {
+         texture = lc->texids[FACE_D];
+         s1 = 1.0;  t1 = 0.914;
+         s2 = 1.0;  t2 = 1.0;
+         s3 = 0.75; t3 = 1.0;
+         s4 = 0.75; t4 = 0.914;
+       }
+
+      face4((texture == -1 ? 0 : texture),
+           (texture == -1 ? interior_color : exterior_color),
+           wire,
+           s1, t1,  0.5,  x2-0.5, y2-0.5,
+           s2, t2,  0.5,  x1-0.5, y1-0.5,
+           s3, t3,  0.25, x1-0.5, y1-0.5,
+           s4, t4,  0.25, x2-0.5, y2-0.5);
+    }
+
+  for (i = 0; i < countof(lifter_perimiter_points_2); i++)
+    {
+      int j = (i+1 >= countof(lifter_perimiter_points_2) ? 0 : i+1);
+      GLfloat x1 = lifter_perimiter_points_2[i][0] / 255.0;
+      GLfloat y1 = lifter_perimiter_points_2[i][1] / 255.0;
+      GLfloat x2 = lifter_perimiter_points_2[j][0] / 255.0;
+      GLfloat y2 = lifter_perimiter_points_2[j][1] / 255.0;
+      int texture = -1;
+      GLfloat s1=0, t1=0, s2=0, t2=0, s3=0, t3=0, s4=0, t4=0;
+
+      if (i == 0)
+       {
+         texture = lc->texids[FACE_D];
+         s1 = 1.0;  t1 = 0.0;
+         s2 = 1.0;  t2 = 0.095;
+         s3 = 0.75; t3 = 0.095;
+         s4 = 0.75; t4 = 0.0;
+       }
+      else if (i == 1)
+       {
+         texture = lc->texids[FACE_N];
+         s1 = 1.0;  t1 = 0.745;
+         s2 = 1.0;  t2 = 1.0;
+         s3 = 0.75; t3 = 1.0;
+         s4 = 0.75; t4 = 0.745;
+       }
+
+      face4((texture == -1 ? 0 : texture),
+           (texture == -1 ? interior_color : exterior_color),
+           wire,
+           s1, t1,  0.5,  x2-0.5, y2-0.5,
+           s2, t2,  0.5,  x1-0.5, y1-0.5,
+           s3, t3,  0.25, x1-0.5, y1-0.5,
+           s4, t4,  0.25, x2-0.5, y2-0.5);
+    }
+
+  for (i = 0; i < countof(lifter_perimiter_points_3); i++)
+    {
+      int j = (i+1 >= countof(lifter_perimiter_points_3) ? 0 : i+1);
+      GLfloat x1 = lifter_perimiter_points_3[i][0] / 255.0;
+      GLfloat y1 = lifter_perimiter_points_3[i][1] / 255.0;
+      GLfloat x2 = lifter_perimiter_points_3[j][0] / 255.0;
+      GLfloat y2 = lifter_perimiter_points_3[j][1] / 255.0;
+      int texture = -1;
+      GLfloat s1=0, t1=0, s2=0, t2=0, s3=0, t3=0, s4=0, t4=0;
+
+      if (i == 0)
+       {
+         texture = lc->texids[FACE_D];
+         s1 = 1.0;  t1 = 0.235;
+         s2 = 1.0;  t2 = 0.765;
+         s3 = 0.75; t3 = 0.765;
+         s4 = 0.75; t4 = 0.235;
+       }
+
+      face4((texture == -1 ? 0 : texture),
+           (texture == -1 ? interior_color : exterior_color),
+           wire,
+           s1, t1,  0.5,  x2-0.5, y2-0.5,
+           s2, t2,  0.5,  x1-0.5, y1-0.5,
+           s3, t3,  0.25, x1-0.5, y1-0.5,
+           s4, t4,  0.25, x2-0.5, y2-0.5);
+    }
+
+  glEndList();
+
+  /* -------------------------------------------------------------------- */
+
+  glNewList(lc->taser_slider, GL_COMPILE);
+  glShadeModel(GL_SMOOTH);
+
+  /* Top face */
+  for (i = 0; i < countof(slider_face_points)/5; i++)
+    {
+      int j;
+#ifdef HAVE_GLBINDTEXTURE
+      glBindTexture(GL_TEXTURE_2D, lc->texids[FACE_E]);
+#endif /* HAVE_GLBINDTEXTURE */
+      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+
+      do_normal(
+          0, slider_face_points[(i*5)+0][0], slider_face_points[(i*5)+0][1],
+          0, slider_face_points[(i*5)+1][0], slider_face_points[(i*5)+1][1],
+          0, slider_face_points[(i*5)+2][0], slider_face_points[(i*5)+2][1]);
+      glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+      for (j = 0; j < 5; j++)
+       {
+         int ix = slider_face_points[(i*5)+j][0];
+         int iy = slider_face_points[(i*5)+j][1];
+         GLfloat x, y;
+         if (ix == -1)  /* these are padding: ignore them */
+           continue;
+         x = ix / 255.0L;
+         y = iy / 255.0L;
+         glTexCoord2f(x, y);
+         glVertex3f(0.5, x-0.5, y-0.5);
+       }
+      glEnd();
+    }
+
+  /* Bottom face */
+  for (i = countof(slider_face_points)/5 - 1; i >= 0; i--)
+    {
+      int j;
+#ifdef HAVE_GLBINDTEXTURE
+      glBindTexture(GL_TEXTURE_2D, 0);
+#endif /* HAVE_GLBINDTEXTURE */
+      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, interior_color);
+
+      do_normal(
+          0, slider_face_points[(i*5)+2][0], slider_face_points[(i*5)+2][1],
+          0, slider_face_points[(i*5)+1][0], slider_face_points[(i*5)+1][1],
+          0, slider_face_points[(i*5)+0][0], slider_face_points[(i*5)+0][1]);
+      glBegin(wire ? GL_LINE_LOOP : GL_POLYGON);
+      for (j = 4; j >= 0; j--)
+       {
+         int ix = slider_face_points[(i*5)+j][0];
+         int iy = slider_face_points[(i*5)+j][1];
+         GLfloat x, y;
+         if (ix == -1)  /* these are padding: ignore them */
+           continue;
+         x = ix / 255.0L;
+         y = iy / 255.0L;
+         glTexCoord2f(x, y);
+         glVertex3f(0.25, x-0.5, y-0.5);
+       }
+      glEnd();
+    }
+
+  /* Side walls */
+  for (i = 0; i < countof(slider_perimiter_points); i++)
+    {
+      int j = (i+1 >= countof(slider_perimiter_points) ? 0 : i+1);
+      GLfloat x1 = slider_perimiter_points[i][0] / 255.0;
+      GLfloat y1 = slider_perimiter_points[i][1] / 255.0;
+      GLfloat x2 = slider_perimiter_points[j][0] / 255.0;
+      GLfloat y2 = slider_perimiter_points[j][1] / 255.0;
+      int texture = -1;
+      GLfloat s1=0, t1=0, s2=0, t2=0, s3=0, t3=0, s4=0, t4=0;
+
+      if (i == 1)
+       {
+         texture = lc->texids[FACE_S];
+         s1 = 1.0;  t1 = 0.255;
+         s2 = 1.0;  t2 = 0.435;
+         s3 = 0.75; t3 = 0.435;
+         s4 = 0.75; t4 = 0.255;
+       }
+      else if (i == 4)
+       {
+         texture = lc->texids[FACE_D];
+         s1 = 1.0;  t1 = 0.758;
+         s2 = 1.0;  t2 = 0.915;
+         s3 = 0.75; t3 = 0.915;
+         s4 = 0.75; t4 = 0.758;
+       }
+      else if (i == 16)
+       {
+         texture = lc->texids[FACE_D];
+         s1 = 1.0;  t1 = 0.095;
+         s2 = 1.0;  t2 = 0.24;
+         s3 = 0.75; t3 = 0.24;
+         s4 = 0.75; t4 = 0.095;
+       }
+      else if (i == 19)
+       {
+         texture = lc->texids[FACE_N];
+         s1 = 1.0;  t1 = 0.568;
+         s2 = 1.0;  t2 = 0.742;
+         s3 = 0.75; t3 = 0.742;
+         s4 = 0.75; t4 = 0.568;
+       }
+
+      face4((texture == -1 ? 0 : texture),
+           (texture == -1 ? interior_color : exterior_color),
+           wire,
+           s1, t1,  0.5,  x2-0.5, y2-0.5,
+           s2, t2,  0.5,  x1-0.5, y1-0.5,
+           s3, t3,  0.25, x1-0.5, y1-0.5,
+           s4, t4,  0.25, x2-0.5, y2-0.5);
+    }
+
+  glEndList();
+}
+
+
+\f
+/* Rendering and animating object models
+ */
+
+static void
+draw(ModeInfo *mi)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  Bool wire = MI_IS_WIREFRAME(mi);
+
+  if (!wire)
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+  else
+    glClear(GL_COLOR_BUFFER_BIT);
+
+  glPushMatrix();
+  {
+    GLfloat x = lc->rotx;
+    GLfloat y = lc->roty;
+    GLfloat z = lc->rotz;
+
+#if 0
+ x=0.75; y=0; z=0; 
+#endif
+
+    if (x < 0) x = 1 - (x + 1);
+    if (y < 0) y = 1 - (y + 1);
+    if (z < 0) z = 1 - (z + 1);
+
+    /* Make into the screen be +Y right be +X, and up be +Z. */
+    glRotatef(-90.0, 1.0, 0.0, 0.0);
+
+    /* Scale it up. */
+    glScalef(4.0, 4.0, 4.0);
+
+#ifdef DEBUG
+    glPushMatrix();
+    {
+      /* Shift to the upper left, and draw the vanilla box. */
+      glTranslatef(-0.6, 0.0, 0.6);
+
+      /* Apply rotation to the object. */
+      glRotatef(x * 360, 1.0, 0.0, 0.0);
+      glRotatef(y * 360, 0.0, 1.0, 0.0);
+      glRotatef(z * 360, 0.0, 0.0, 1.0);
+
+      /* Draw it. */
+      glCallList(lc->box);
+    }
+    glPopMatrix();
+
+    /* Shift to the lower right, and draw the animated object. */
+    glTranslatef(0.6, 0.0, -0.6);
+#endif /* DEBUG */
+
+
+    glPushMatrix();
+    {
+      /* Apply rotation to the object. */
+      glRotatef(x * 360, 1.0, 0.0, 0.0);
+      glRotatef(y * 360, 0.0, 1.0, 0.0);
+      glRotatef(z * 360, 0.0, 0.0, 1.0);
+
+      switch (lc->type)
+       {
+       case LAMENT_BOX:
+         glCallList(lc->box);
+         break;
+
+       case LAMENT_STAR_OUT:
+       case LAMENT_STAR_ROT:
+       case LAMENT_STAR_ROT_IN:
+       case LAMENT_STAR_ROT_OUT:
+       case LAMENT_STAR_UNROT:
+       case LAMENT_STAR_IN:
+         glTranslatef(0.0, 0.0, lc->anim_z/2);
+         glRotatef(lc->anim_r/2, 0.0, 0.0, 1.0);
+         glCallList(lc->star1);
+
+         glTranslatef(0.0, 0.0, -lc->anim_z);
+         glRotatef(-lc->anim_r, 0.0, 0.0, 1.0);
+         glCallList(lc->star2);
+         break;
+
+       case LAMENT_TETRA_UNE:
+       case LAMENT_TETRA_USW:
+       case LAMENT_TETRA_DWN:
+       case LAMENT_TETRA_DSE:
+         {
+           int magic;
+           GLfloat x, y, z;
+           switch (lc->type) {
+           case LAMENT_TETRA_UNE: magic = lc->tetra_une;
+             x = 1.0; y = 1.0; z = 1.0; break;
+           case LAMENT_TETRA_USW: magic = lc->tetra_usw;
+             x = 1.0; y = 1.0; z = -1.0; break;
+           case LAMENT_TETRA_DWN: magic = lc->tetra_dwn;
+             x = 1.0; y = -1.0; z = 1.0; break;
+           case LAMENT_TETRA_DSE: magic = lc->tetra_dse;
+             x = -1.0; y = 1.0; z = 1.0; break;
+           default: abort(); break;
+           }
+           glCallList(lc->tetra_mid);
+           if (magic != lc->tetra_une) glCallList(lc->tetra_une);
+           if (magic != lc->tetra_usw) glCallList(lc->tetra_usw);
+           if (magic != lc->tetra_dwn) glCallList(lc->tetra_dwn);
+           if (magic != lc->tetra_dse) glCallList(lc->tetra_dse);
+           glRotatef(lc->anim_r, x, y, z);
+           glCallList(magic);
+         }
+         break;
+
+       case LAMENT_LID_OPEN:
+       case LAMENT_LID_CLOSE:
+       case LAMENT_LID_ZOOM:
+         {
+           GLfloat d = 0.417;
+
+           glTranslatef(lc->anim_z, 0.0, 0.0);
+
+           glCallList(lc->lid_0);
+
+           glPushMatrix();
+             glTranslatef(-0.5, -d, 0.0);
+             glRotatef(-lc->anim_r, 0.0, -1.0, -1.0);
+             glTranslatef( 0.5,  d, 0.0);
+             glCallList(lc->lid_1);
+           glPopMatrix();
+           glPushMatrix();
+             glTranslatef(-0.5, -d, 0.0);
+             glRotatef( lc->anim_r, 0.0, -1.0,   1.0);
+             glTranslatef( 0.5,  d, 0.0);
+             glCallList(lc->lid_2);
+           glPopMatrix();
+           glPushMatrix();
+             glTranslatef(-0.5,  d, 0.0);
+             glRotatef( lc->anim_r, 0.0,  -1.0,  -1.0);
+             glTranslatef( 0.5, -d, 0.0);
+             glCallList(lc->lid_3);
+           glPopMatrix();
+           glPushMatrix();
+             glTranslatef(-0.5,  d, 0.0);
+             glRotatef(-lc->anim_r, 0.0,  -1.0,   1.0);
+             glTranslatef( 0.5, -d, 0.0);
+             glCallList(lc->lid_4);
+           glPopMatrix();
+         }
+         break;
+
+       case LAMENT_TASER_OUT:
+       case LAMENT_TASER_SLIDE:
+       case LAMENT_TASER_SLIDE_IN:
+       case LAMENT_TASER_IN:
+
+         glTranslatef(-lc->anim_z/2, 0.0, 0.0);
+         glCallList(lc->taser_base);
+
+         glTranslatef(lc->anim_z, 0.0, 0.0);
+         glCallList(lc->taser_lifter);
+
+         glTranslatef(0.0, 0.0, lc->anim_y);
+         glCallList(lc->taser_slider);
+         break;
+
+       default:
+         abort();
+         break;
+       }
+    }
+    glPopMatrix();
+
+  }
+  glPopMatrix();
+}
+
+
+static void
+animate(ModeInfo *mi)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  int pause = 10;
+/*  int pause2 = 60;*/
+  int pause3 = 120;
+
+  switch (lc->type)
+    {
+    case LAMENT_BOX:
+      {
+       /* Rather than just picking states randomly, pick an ordering randomly,
+          do it, and then re-randomize.  That way one can be assured of seeing
+          all states in a short time period, though not always in the same
+          order (it's frustrating to see it pick the same state 5x in a row.)
+        */
+       static lament_type states[] = {
+         LAMENT_STAR_OUT, LAMENT_STAR_OUT,
+         LAMENT_TETRA_UNE, LAMENT_TETRA_USW,
+         LAMENT_TETRA_DWN, LAMENT_TETRA_DSE,
+         LAMENT_LID_OPEN, LAMENT_LID_OPEN, LAMENT_LID_OPEN,
+         LAMENT_TASER_OUT, LAMENT_TASER_OUT,
+         LAMENT_BOX, LAMENT_BOX, LAMENT_BOX, LAMENT_BOX, LAMENT_BOX,
+         LAMENT_BOX, LAMENT_BOX, LAMENT_BOX, LAMENT_BOX, LAMENT_BOX,
+       };
+       static int state = countof(states);
+
+       if (state < countof(states))
+         {
+           lc->type = states[state++];
+         }
+       else
+         {
+           int i;
+           state = 0;
+           for (i = 0; i < countof(states); i++)
+             {
+               int a = random() % countof(states);
+               lament_type swap = states[a];
+               states[a] = states[i];
+               states[i] = swap;
+             }
+         }
+
+       if (lc->type == LAMENT_BOX)
+         lc->anim_pause = pause3;
+
+       lc->anim_r = 0.0;
+       lc->anim_y = 0.0;
+       lc->anim_z = 0.0;
+      }
+      break;
+
+      /* -------------------------------------------------------------- */
+
+    case LAMENT_STAR_OUT:
+      lc->anim_z += 0.01;
+      if (lc->anim_z >= 1.0)
+       {
+         lc->anim_z = 1.0;
+         lc->type = LAMENT_STAR_ROT;
+         lc->anim_pause = pause;
+       }
+      break;
+
+    case LAMENT_STAR_ROT:
+      lc->anim_r += 1.0;
+      if (lc->anim_r >= 45.0)
+       {
+         lc->anim_r = 45.0;
+         lc->type = LAMENT_STAR_ROT_IN;
+         lc->anim_pause = pause;
+       }
+      break;
+
+    case LAMENT_STAR_ROT_IN:
+      lc->anim_z -= 0.01;
+      if (lc->anim_z <= 0.0)
+       {
+         lc->anim_z = 0.0;
+         lc->type = LAMENT_STAR_ROT_OUT;
+         lc->anim_pause = pause3 * (1 + (random() % 4) + (random() % 4));
+       }
+      break;
+
+    case LAMENT_STAR_ROT_OUT:
+      lc->anim_z += 0.01;
+      if (lc->anim_z >= 1.0)
+       {
+         lc->anim_z = 1.0;
+         lc->type = LAMENT_STAR_UNROT;
+         lc->anim_pause = pause;
+       }
+      break;
+      
+    case LAMENT_STAR_UNROT:
+      lc->anim_r -= 1.0;
+      if (lc->anim_r <= 0.0)
+       {
+         lc->anim_r = 0.0;
+         lc->type = LAMENT_STAR_IN;
+         lc->anim_pause = pause;
+       }
+      break;
+
+    case LAMENT_STAR_IN:
+      lc->anim_z -= 0.01;
+      if (lc->anim_z <= 0.0)
+       {
+         lc->anim_z = 0.0;
+         lc->type = LAMENT_BOX;
+         lc->anim_pause = pause3;
+       }
+      break;
+
+      /* -------------------------------------------------------------- */
+
+    case LAMENT_TETRA_UNE:
+    case LAMENT_TETRA_USW:
+    case LAMENT_TETRA_DWN:
+    case LAMENT_TETRA_DSE:
+
+      lc->anim_r += 1.0;
+      if (lc->anim_r >= 360.0)
+       {
+         lc->anim_r = 0.0;
+         lc->type = LAMENT_BOX;
+         lc->anim_pause = pause3;
+       }
+      else if (lc->anim_r > 119.0 && lc->anim_r <= 120.0)
+       {
+         lc->anim_r = 120.0;
+         lc->anim_pause = pause;
+       }
+      else if (lc->anim_r > 239.0 && lc->anim_r <= 240.0)
+       {
+         lc->anim_r = 240.0;
+         lc->anim_pause = pause;
+       }
+      break;
+
+      /* -------------------------------------------------------------- */
+
+    case LAMENT_LID_OPEN:
+      lc->anim_r += 1.0;
+
+      if (lc->anim_r >= 112.0)
+       {
+         GLfloat hysteresis = 0.05;
+
+         lc->anim_r = 112.0;
+         lc->anim_z = 0.0;
+         lc->anim_pause = pause3;
+
+         if (lc->rotx >= -hysteresis &&
+             lc->rotx <=  hysteresis &&
+             ((lc->rotz >=  (0.25 - hysteresis) &&
+               lc->rotz <=  (0.25 + hysteresis)) ||
+              (lc->rotz >= (-0.25 - hysteresis) &&
+               lc->rotz <= (-0.25 + hysteresis))))
+           {
+             lc->type = LAMENT_LID_ZOOM;
+             lc->rotx = 0.00;
+             lc->rotz = (lc->rotz < 0 ? -0.25 : 0.25);
+           }
+         else
+           {
+             lc->type = LAMENT_LID_CLOSE;
+           }
+       }
+      break;
+
+    case LAMENT_LID_CLOSE:
+      lc->anim_r -= 1.0;
+      if (lc->anim_r <= 0.0)
+       {
+         lc->anim_r = 0.0;
+         lc->type = LAMENT_BOX;
+         lc->anim_pause = pause3;
+       }
+      break;
+
+    case LAMENT_LID_ZOOM:
+      lc->anim_z -= 0.1;
+      if (lc->anim_z < -50.0)
+       {
+         lc->anim_r = 0.0;
+         lc->anim_z = 0.0;
+         lc->rotx = frand(1.0) * RANDSIGN();
+         lc->roty = frand(1.0) * RANDSIGN();
+         lc->rotz = frand(1.0) * RANDSIGN();
+         lc->type = LAMENT_BOX;
+       }
+      break;
+
+      /* -------------------------------------------------------------- */
+
+    case LAMENT_TASER_OUT:
+      lc->anim_z += 0.0025;
+      if (lc->anim_z >= 0.25)
+       {
+         lc->anim_z = 0.25;
+         lc->type = LAMENT_TASER_SLIDE;
+         lc->anim_pause = pause * (1 + (random() % 5) + (random() % 5));
+       }
+      break;
+
+    case LAMENT_TASER_SLIDE:
+      lc->anim_y += 0.0025;
+      if (lc->anim_y >= 0.23)
+       {
+         lc->anim_y = 0.23;
+         lc->type = LAMENT_TASER_SLIDE_IN;
+         lc->anim_pause = pause3 * (1 + (random() % 5) + (random() % 5));
+       }
+      break;
+
+    case LAMENT_TASER_SLIDE_IN:
+      lc->anim_y -= 0.0025;
+      if (lc->anim_y <= 0.0)
+       {
+         lc->anim_y = 0.0;
+         lc->type = LAMENT_TASER_IN;
+         lc->anim_pause = pause;
+       }
+      break;
+
+    case LAMENT_TASER_IN:
+      lc->anim_z -= 0.0025;
+      if (lc->anim_z <= 0.0)
+       {
+         lc->anim_z = 0.0;
+         lc->type = LAMENT_BOX;
+         lc->anim_pause = pause3;
+       }
+      break;
+
+    default:
+      abort();
+      break;
+    }
+}
+
+
+static void
+rotate(GLfloat *pos, GLfloat *v, GLfloat *dv, GLfloat max_v)
+{
+  double ppos = *pos;
+
+  /* tick position */
+  if (ppos < 0)
+    ppos = -(ppos + *v);
+  else
+    ppos += *v;
+
+  if (ppos > 1.0)
+    ppos -= 1.0;
+  else if (ppos < 0)
+    ppos += 1.0;
+
+  if (ppos < 0) abort();
+  if (ppos > 1.0) abort();
+  *pos = (*pos > 0 ? ppos : -ppos);
+
+  /* accelerate */
+  *v += *dv;
+
+  /* clamp velocity */
+  if (*v > max_v || *v < -max_v)
+    {
+      *dv = -*dv;
+    }
+  /* If it stops, start it going in the other direction. */
+  else if (*v < 0)
+    {
+      if (random() % 4)
+       {
+         *v = 0;
+
+         /* keep going in the same direction */
+         if (random() % 2)
+           *dv = 0;
+         else if (*dv < 0)
+           *dv = -*dv;
+       }
+      else
+       {
+         /* reverse gears */
+         *v = -*v;
+         *dv = -*dv;
+         *pos = -*pos;
+       }
+    }
+
+  /* Alter direction of rotational acceleration randomly. */
+  if (! (random() % 120))
+    *dv = -*dv;
+
+  /* Change acceleration very occasionally. */
+  if (! (random() % 200))
+    {
+      if (*dv == 0)
+       *dv = 0.00001;
+      else if (random() & 1)
+       *dv *= 1.2;
+      else
+       *dv *= 0.8;
+    }
+}
+
+
+\f
+/* Window management, etc
+ */
+
+static void
+reshape(int width, int height)
+{
+  int target_size = 180;
+  int win_size = (width > height ? height : width);
+  GLfloat h = (GLfloat) height / (GLfloat) width;
+
+  glViewport(0, 0, (GLint) width, (GLint) height);
+
+/*  glViewport(-600, -600, 1800, 1800); */
+
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();
+  glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  glTranslatef(0.0, 0.0, -40.0);
+
+  /* This scale makes the box take up most of the window */
+  glScalef(2.0, 2.0, 2.0);
+
+  /* But if the window is more than a little larger than our target size,
+     scale the object back down, so that the bits drawn on the screen end
+     up rougly target_size across (actually it ends up a little larger.)
+     Note that the image-map bits we have are 128x128.  Therefore, if the
+     image is magnified a lot, it looks pretty blocky.  So it's better to
+     have a 128x128 animation on a 1280x1024 screen that looks good, than
+     a 1024x1024 animation that looks really pixellated.
+   */
+  if (win_size > target_size * 1.5)
+    {
+      GLfloat ratio = ((GLfloat) target_size / (GLfloat) win_size);
+      ratio *= 2.0;
+      glScalef(ratio, ratio, ratio);
+    }
+
+  /* The depth buffer will be cleared, if needed, before the
+   * next frame.  Right now we just want to black the screen.
+   */
+  glClear(GL_COLOR_BUFFER_BIT);
+}
+
+
+static void
+gl_init(ModeInfo *mi)
+{
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  Bool wire = MI_IS_WIREFRAME(mi);
+
+  if (wire)
+    do_texture = False;
+
+  if (!wire)
+    {
+      static GLfloat pos0[]  = { -4.0, 2.0, 5.0, 1.0 };
+      static GLfloat pos1[]  = { 12.0, 5.0, 1.0, 1.0 };
+      static GLfloat local[] = { 0.0 };
+      static GLfloat ambient[] = { 0.3, 0.3, 0.3, 1.0 };
+      static GLfloat spec[] = { 1.0, 1.0, 1.0, 1.0 };
+      static GLfloat shine[] = { 100.0 };
+
+      glLightfv(GL_LIGHT0, GL_POSITION, pos0);
+      glLightfv(GL_LIGHT1, GL_POSITION, pos1);
+
+      glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
+      glLightfv(GL_LIGHT1, GL_AMBIENT, ambient);
+
+      glLightfv(GL_LIGHT0, GL_SPECULAR, spec);
+      glLightfv(GL_LIGHT1, GL_SPECULAR, spec);
+
+      glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local);
+      glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+      glMaterialfv(GL_FRONT, GL_SPECULAR, spec);
+      glMaterialfv(GL_FRONT, GL_SHININESS, shine);
+
+      glEnable(GL_LIGHTING);
+      glEnable(GL_LIGHT0);
+      glEnable(GL_LIGHT1);
+      glDisable(GL_LIGHT1);
+
+      glEnable(GL_DEPTH_TEST);
+      glEnable(GL_TEXTURE_2D);
+      glEnable(GL_NORMALIZE);
+      glEnable(GL_CULL_FACE);
+    }
+
+  if (do_texture)
+    {
+#ifdef HAVE_GLBINDTEXTURE
+      int i;
+      for (i = 0; i < 6; i++)
+       glGenTextures(1, &lc->texids[i]);
+
+      parse_image_data(mi);
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+      glPixelStorei(GL_UNPACK_ROW_LENGTH, lc->texture->width);
+
+      for (i = 0; i < 6; i++)
+       {
+         int height = lc->texture->width;      /* assume square */
+         glBindTexture(GL_TEXTURE_2D, lc->texids[i]);
+         glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, exterior_color);
+         glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+                      lc->texture->width, height, 0,
+                      GL_RGBA, GL_UNSIGNED_BYTE,
+                      (lc->texture->data +
+                       (lc->texture->bytes_per_line * height * i)));
+
+         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+         glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+         glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
+       }
+
+#else  /* !HAVE_GLBINDTEXTURE */
+      fprintf(stderr,
+             "%s: this version of GL doesn't support multiple texture maps.\n"
+             "\tGet OpenGL 1.1.\n",
+             progname);
+      exit (1);
+#endif /* !HAVE_GLBINDTEXTURE */
+    }
+
+  lc->box = glGenLists(16);
+  lc->star1 = lc->box+1;
+  lc->star2 = lc->box+2;
+  lc->tetra_une = lc->box+3;
+  lc->tetra_usw = lc->box+4;
+  lc->tetra_dwn = lc->box+5;
+  lc->tetra_dse = lc->box+6;
+  lc->tetra_mid = lc->box+7;
+  lc->lid_0 = lc->box+8;
+  lc->lid_1 = lc->box+9;
+  lc->lid_2 = lc->box+10;
+  lc->lid_3 = lc->box+11;
+  lc->lid_4 = lc->box+12;
+  lc->taser_base = lc->box+13;
+  lc->taser_lifter = lc->box+14;
+  lc->taser_slider = lc->box+15;
+
+  box(mi, wire);
+  star(mi, True, wire);
+  star(mi, False, wire);
+  tetra(mi, wire);
+  lid(mi, wire);
+  taser(mi, wire);
+}
+
+
+void
+init_lament(ModeInfo *mi)
+{
+  lament_configuration *lc;
+  if (!lcs)
+    {
+      lcs = (lament_configuration *)
+       calloc(MI_NUM_SCREENS(mi), sizeof (lament_configuration));
+      if (!lcs)
+       {
+         fprintf(stderr, "%s: out of memory\n", progname);
+         exit(1);
+       }
+    }
+
+  lc = &lcs[MI_SCREEN(mi)];
+
+  lc->rotx = frand(1.0) * RANDSIGN();
+  lc->roty = frand(1.0) * RANDSIGN();
+  lc->rotz = frand(1.0) * RANDSIGN();
+
+  /* bell curve from 0-1.5 degrees, avg 0.75 */
+  lc->dx = (frand(1) + frand(1) + frand(1)) / (360*2);
+  lc->dy = (frand(1) + frand(1) + frand(1)) / (360*2);
+  lc->dz = (frand(1) + frand(1) + frand(1)) / (360*2);
+
+  lc->d_max = lc->dx * 2;
+
+  lc->ddx = 0.00006 + frand(0.00003);
+  lc->ddy = 0.00006 + frand(0.00003);
+  lc->ddz = 0.00006 + frand(0.00003);
+
+  lc->ddx = 0.00001;
+  lc->ddy = 0.00001;
+  lc->ddz = 0.00001;
+
+  lc->type = LAMENT_BOX;
+  lc->anim_pause = 300 + (random() % 100);
+
+  if ((lc->glx_context = init_GL(mi)) != NULL)
+    {
+      reshape(MI_WIDTH(mi), MI_HEIGHT(mi));
+      gl_init(mi);
+    }
+}
+
+
+void
+draw_lament(ModeInfo *mi)
+{
+  static int tick = 0;
+  lament_configuration *lc = &lcs[MI_SCREEN(mi)];
+  Display *dpy = MI_DISPLAY(mi);
+  Window window = MI_WINDOW(mi);
+
+  if (!lc->glx_context)
+    return;
+
+  glDrawBuffer(GL_BACK);
+
+  glXMakeCurrent(dpy, window, *(lc->glx_context));
+  draw(mi);
+  glFinish();
+  glXSwapBuffers(dpy, window);
+
+  if (lc->type != LAMENT_LID_ZOOM)
+    {
+      rotate(&lc->rotx, &lc->dx, &lc->ddx, lc->d_max);
+      rotate(&lc->roty, &lc->dy, &lc->ddy, lc->d_max);
+      rotate(&lc->rotz, &lc->dz, &lc->ddz, lc->d_max);
+    }
+
+  if (lc->anim_pause)
+    lc->anim_pause--;
+  else
+    animate(mi);
+
+  if (++tick > 500)
+    {
+      tick = 0;
+      reshape(MI_WIDTH(mi), MI_HEIGHT(mi));
+    }
+}
+
+#endif /* USE_GL */
diff --git a/hacks/glx/lament.man b/hacks/glx/lament.man
new file mode 100644 (file)
index 0000000..4c582c9
--- /dev/null
@@ -0,0 +1,60 @@
+.TH XScreenSaver 1 "25-Jul-98" "X Version 11"
+.SH NAME
+lament - animates the Lament Configuration
+.SH SYNOPSIS
+.B goop
+[\-display \fIhost:display.screen\fP] [\-window] [\-root] [\-install] [\-visual \fIvisual\fP] [\-texture] [\-no\-texture] [\-wireframe]
+.SH DESCRIPTION
+The \fIlament\fP program draws an animation of a particular puzzle box
+repeatedly solving itself.
+.SH OPTIONS
+.I lament
+accepts the following options:
+.TP 8
+.B \-window
+Draw on a newly-created window.  This is the default.
+.TP 8
+.B \-root
+Draw on the root window.
+.TP 8
+.B \-install
+Install a private colormap for the window.
+.TP 8
+.B \-visual \fIvisual\fP\fP
+Specify which visual to use.  Legal values are the name of a visual class,
+or the id number (decimal or hex) of a specific visual.
+.TP 8
+.B \-texture
+Use texture maps.  This is the default.
+.TP 8
+.B \-no\-texture
+Do not use texture maps.  This is boring and wrong.
+.TP 8
+.B \-wireframe
+Only draw outlines.
+.SH ENVIRONMENT
+.PP
+.TP 8
+.B DISPLAY
+to get the default host and display number.
+.TP 8
+.B XENVIRONMENT
+to get the name of a resource file that overrides the global resources
+stored in the RESOURCE_MANAGER property.
+.SH BUGS
+This hack is glacially slow on machines lacking hardware texture support.
+
+Occasionally opens doors, admitting theologians of the Order of the Gash.
+.SH SEE ALSO
+.BR X (1),
+.BR xscreensaver (1)
+.SH COPYRIGHT
+Copyright \(co 1998 by Jamie Zawinski.  Permission to use, copy, modify, 
+distribute, and sell this software and its documentation for any purpose is 
+hereby granted without fee, provided that the above copyright notice appear 
+in all copies and that both that copyright notice and this permission notice
+appear in supporting documentation.  No representations are made about the 
+suitability of this software for any purpose.  It is provided "as is" without
+express or implied warranty.
+.SH AUTHOR
+Jamie Zawinski <jwz@jwz.org>, 25-Jul-98.
index 878e8edc333f10bc65bf5f6f6828093bbf5c4100..a3de1b9e2dfd9a7a5404598c57cd31b29d41ad55 100644 (file)
@@ -1,7 +1,7 @@
 /* atlantis --- Shows moving 3D sea animals */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)shark.c      1.1 98/05/13 xlockmore";
+static const char sccsid[] = "@(#)shark.c      1.2 98/06/16 xlockmore";
 
 #endif
 
@@ -72,6 +72,7 @@ static const char sccsid[] = "@(#)shark.c     1.1 98/05/13 xlockmore";
  *
  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  */
+
 #ifndef STANDALONE
 #include "xlock.h"
 #endif
@@ -79,10 +80,10 @@ static const char sccsid[] = "@(#)shark.c   1.1 98/05/13 xlockmore";
 #ifdef USE_GL
 
 #ifdef STANDALONE
+#include <math.h>
 #include <GL/glx.h>
 #endif
 
-#include <math.h>
 #include "atlantis.h"
 /* *INDENT-OFF* */
 #if 0
@@ -304,1096 +305,1100 @@ static float iP069[3] = {0.00, -418.25, 5765.04};
 static float iP070[3] = {0.00, 1266.91, 6629.60};
 /* *INDENT-ON* */
 
+
+
 static void
-Fish001(void)
+Fish001(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N007);
-    glVertex3fv(P007);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N004);
-    glVertex3fv(P004);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glNormal3fv(N007);
-    glVertex3fv(P007);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N004);
-    glVertex3fv(P004);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P071);
-    glVertex3fv(P072);
-    glVertex3fv(P073);
-    glVertex3fv(P074);
-    glVertex3fv(P075);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P077);
-    glVertex3fv(P078);
-    glVertex3fv(P079);
-    glVertex3fv(P080);
-    glVertex3fv(P081);
-    glVertex3fv(P082);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N007);
+       glVertex3fv(P007);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N004);
+       glVertex3fv(P004);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glNormal3fv(N007);
+       glVertex3fv(P007);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N004);
+       glVertex3fv(P004);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P071);
+       glVertex3fv(P072);
+       glVertex3fv(P073);
+       glVertex3fv(P074);
+       glVertex3fv(P075);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P077);
+       glVertex3fv(P078);
+       glVertex3fv(P079);
+       glVertex3fv(P080);
+       glVertex3fv(P081);
+       glVertex3fv(P082);
+       glEnd();
 }
 
 static void
-Fish002(void)
+Fish002(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
 }
 
 static void
-Fish003(void)
+Fish003(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glEnd();
 }
 
 static void
-Fish004(void)
+Fish004(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N061);
-    glVertex3fv(P061);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N061);
-    glVertex3fv(P061);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N061);
-    glVertex3fv(P061);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N061);
-    glVertex3fv(P061);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N061);
-    glVertex3fv(P061);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N061);
+       glVertex3fv(P061);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N061);
+       glVertex3fv(P061);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N061);
+       glVertex3fv(P061);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N061);
+       glVertex3fv(P061);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N061);
+       glVertex3fv(P061);
+       glEnd();
 }
 
 static void
-Fish005(void)
+Fish005(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
 }
 
 static void
-Fish006(void)
+Fish006(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glEnd();
 }
 
 static void
-Fish007(void)
+Fish007(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N064);
-    glVertex3fv(P064);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N064);
+       glVertex3fv(P064);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
 }
 
 static void
-Fish008(void)
+Fish008(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
 }
 
 static void
-Fish009(void)
+Fish009(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glVertex3fv(P059);
-    glVertex3fv(P012);
-    glVertex3fv(P009);
-    glVertex3fv(P060);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P012);
-    glVertex3fv(P004);
-    glVertex3fv(P007);
-    glVertex3fv(P009);
-    glEnd();
+       glBegin(cap);
+       glVertex3fv(P059);
+       glVertex3fv(P012);
+       glVertex3fv(P009);
+       glVertex3fv(P060);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P012);
+       glVertex3fv(P004);
+       glVertex3fv(P007);
+       glVertex3fv(P009);
+       glEnd();
 }
 
 static void
-Fish_1(void)
+Fish_1(GLenum cap)
 {
-    Fish004();
-    Fish005();
-    Fish003();
-    Fish007();
-    Fish006();
-    Fish002();
-    Fish008();
-    Fish009();
-    Fish001();
+       Fish004(cap);
+       Fish005(cap);
+       Fish003(cap);
+       Fish007(cap);
+       Fish006(cap);
+       Fish002(cap);
+       Fish008(cap);
+       Fish009(cap);
+       Fish001(cap);
 }
 
 static void
-Fish_2(void)
+Fish_2(GLenum cap)
 {
-    Fish005();
-    Fish004();
-    Fish003();
-    Fish008();
-    Fish006();
-    Fish002();
-    Fish007();
-    Fish009();
-    Fish001();
+       Fish005(cap);
+       Fish004(cap);
+       Fish003(cap);
+       Fish008(cap);
+       Fish006(cap);
+       Fish002(cap);
+       Fish007(cap);
+       Fish009(cap);
+       Fish001(cap);
 }
 
 static void
-Fish_3(void)
+Fish_3(GLenum cap)
 {
-    Fish005();
-    Fish004();
-    Fish007();
-    Fish003();
-    Fish002();
-    Fish008();
-    Fish009();
-    Fish001();
-    Fish006();
+       Fish005(cap);
+       Fish004(cap);
+       Fish007(cap);
+       Fish003(cap);
+       Fish002(cap);
+       Fish008(cap);
+       Fish009(cap);
+       Fish001(cap);
+       Fish006(cap);
 }
 
 static void
-Fish_4(void)
+Fish_4(GLenum cap)
 {
-    Fish005();
-    Fish004();
-    Fish008();
-    Fish003();
-    Fish002();
-    Fish007();
-    Fish009();
-    Fish001();
-    Fish006();
+       Fish005(cap);
+       Fish004(cap);
+       Fish008(cap);
+       Fish003(cap);
+       Fish002(cap);
+       Fish007(cap);
+       Fish009(cap);
+       Fish001(cap);
+       Fish006(cap);
 }
 
 static void
-Fish_5(void)
+Fish_5(GLenum cap)
 {
-    Fish009();
-    Fish006();
-    Fish007();
-    Fish001();
-    Fish002();
-    Fish003();
-    Fish008();
-    Fish004();
-    Fish005();
+       Fish009(cap);
+       Fish006(cap);
+       Fish007(cap);
+       Fish001(cap);
+       Fish002(cap);
+       Fish003(cap);
+       Fish008(cap);
+       Fish004(cap);
+       Fish005(cap);
 }
 
 static void
-Fish_6(void)
+Fish_6(GLenum cap)
 {
-    Fish009();
-    Fish006();
-    Fish008();
-    Fish001();
-    Fish002();
-    Fish007();
-    Fish003();
-    Fish004();
-    Fish005();
+       Fish009(cap);
+       Fish006(cap);
+       Fish008(cap);
+       Fish001(cap);
+       Fish002(cap);
+       Fish007(cap);
+       Fish003(cap);
+       Fish004(cap);
+       Fish005(cap);
 }
 
 static void
-Fish_7(void)
+Fish_7(GLenum cap)
 {
-    Fish009();
-    Fish001();
-    Fish007();
-    Fish005();
-    Fish002();
-    Fish008();
-    Fish003();
-    Fish004();
-    Fish006();
+       Fish009(cap);
+       Fish001(cap);
+       Fish007(cap);
+       Fish005(cap);
+       Fish002(cap);
+       Fish008(cap);
+       Fish003(cap);
+       Fish004(cap);
+       Fish006(cap);
 }
 
 static void
-Fish_8(void)
+Fish_8(GLenum cap)
 {
-    Fish009();
-    Fish008();
-    Fish001();
-    Fish002();
-    Fish007();
-    Fish003();
-    Fish005();
-    Fish004();
-    Fish006();
+       Fish009(cap);
+       Fish008(cap);
+       Fish001(cap);
+       Fish002(cap);
+       Fish007(cap);
+       Fish003(cap);
+       Fish005(cap);
+       Fish004(cap);
+       Fish006(cap);
 }
 
 void
-DrawShark(fishRec * fish)
+DrawShark(fishRec * fish, int wire)
 {
-    float mat[4][4];
-    int n;
-    float seg1, seg2, seg3, seg4, segup;
-    float thrash, chomp;
+       float       mat[4][4];
+       int         n;
+       float       seg1, seg2, seg3, seg4, segup;
+       float       thrash, chomp;
+       GLenum      cap;
 
-    fish->htail = (int) (fish->htail - (int) (5.0 * fish->v)) % 360;
+       fish->htail = (int) (fish->htail - (int) (5.0 * fish->v)) % 360;
 
-    thrash = 50.0 * fish->v;
+       thrash = 50.0 * fish->v;
 
-    seg1 = 0.6 * thrash * sin(fish->htail * RRAD);
-    seg2 = 1.8 * thrash * sin((fish->htail + 45.0) * RRAD);
-    seg3 = 3.0 * thrash * sin((fish->htail + 90.0) * RRAD);
-    seg4 = 4.0 * thrash * sin((fish->htail + 110.0) * RRAD);
+       seg1 = 0.6 * thrash * sin(fish->htail * RRAD);
+       seg2 = 1.8 * thrash * sin((fish->htail + 45.0) * RRAD);
+       seg3 = 3.0 * thrash * sin((fish->htail + 90.0) * RRAD);
+       seg4 = 4.0 * thrash * sin((fish->htail + 110.0) * RRAD);
 
-    chomp = 0.0;
-    if (fish->v > 2.0) {
-        chomp = -(fish->v - 2.0) * 200.0;
-    }
-    P004[1] = iP004[1] + chomp;
-    P007[1] = iP007[1] + chomp;
-    P010[1] = iP010[1] + chomp;
-    P011[1] = iP011[1] + chomp;
+       chomp = 0.0;
+       if (fish->v > 2.0) {
+               chomp = -(fish->v - 2.0) * 200.0;
+       }
+       P004[1] = iP004[1] + chomp;
+       P007[1] = iP007[1] + chomp;
+       P010[1] = iP010[1] + chomp;
+       P011[1] = iP011[1] + chomp;
 
-    P023[0] = iP023[0] + seg1;
-    P024[0] = iP024[0] + seg1;
-    P025[0] = iP025[0] + seg1;
-    P026[0] = iP026[0] + seg1;
-    P027[0] = iP027[0] + seg1;
-    P028[0] = iP028[0] + seg1;
-    P029[0] = iP029[0] + seg1;
-    P030[0] = iP030[0] + seg1;
-    P031[0] = iP031[0] + seg1;
-    P032[0] = iP032[0] + seg1;
-    P033[0] = iP033[0] + seg2;
-    P034[0] = iP034[0] + seg2;
-    P035[0] = iP035[0] + seg2;
-    P036[0] = iP036[0] + seg2;
-    P037[0] = iP037[0] + seg2;
-    P038[0] = iP038[0] + seg2;
-    P039[0] = iP039[0] + seg2;
-    P040[0] = iP040[0] + seg2;
-    P041[0] = iP041[0] + seg2;
-    P042[0] = iP042[0] + seg2;
-    P043[0] = iP043[0] + seg3;
-    P044[0] = iP044[0] + seg3;
-    P045[0] = iP045[0] + seg3;
-    P046[0] = iP046[0] + seg3;
-    P047[0] = iP047[0] + seg3;
-    P048[0] = iP048[0] + seg3;
-    P049[0] = iP049[0] + seg3;
-    P050[0] = iP050[0] + seg3;
-    P051[0] = iP051[0] + seg3;
-    P052[0] = iP052[0] + seg3;
-    P002[0] = iP002[0] + seg4;
-    P061[0] = iP061[0] + seg4;
-    P069[0] = iP069[0] + seg4;
-    P070[0] = iP070[0] + seg4;
+       P023[0] = iP023[0] + seg1;
+       P024[0] = iP024[0] + seg1;
+       P025[0] = iP025[0] + seg1;
+       P026[0] = iP026[0] + seg1;
+       P027[0] = iP027[0] + seg1;
+       P028[0] = iP028[0] + seg1;
+       P029[0] = iP029[0] + seg1;
+       P030[0] = iP030[0] + seg1;
+       P031[0] = iP031[0] + seg1;
+       P032[0] = iP032[0] + seg1;
+       P033[0] = iP033[0] + seg2;
+       P034[0] = iP034[0] + seg2;
+       P035[0] = iP035[0] + seg2;
+       P036[0] = iP036[0] + seg2;
+       P037[0] = iP037[0] + seg2;
+       P038[0] = iP038[0] + seg2;
+       P039[0] = iP039[0] + seg2;
+       P040[0] = iP040[0] + seg2;
+       P041[0] = iP041[0] + seg2;
+       P042[0] = iP042[0] + seg2;
+       P043[0] = iP043[0] + seg3;
+       P044[0] = iP044[0] + seg3;
+       P045[0] = iP045[0] + seg3;
+       P046[0] = iP046[0] + seg3;
+       P047[0] = iP047[0] + seg3;
+       P048[0] = iP048[0] + seg3;
+       P049[0] = iP049[0] + seg3;
+       P050[0] = iP050[0] + seg3;
+       P051[0] = iP051[0] + seg3;
+       P052[0] = iP052[0] + seg3;
+       P002[0] = iP002[0] + seg4;
+       P061[0] = iP061[0] + seg4;
+       P069[0] = iP069[0] + seg4;
+       P070[0] = iP070[0] + seg4;
 
-    fish->vtail += ((fish->dtheta - fish->vtail) * 0.1);
+       fish->vtail += ((fish->dtheta - fish->vtail) * 0.1);
 
-    if (fish->vtail > 0.5) {
-        fish->vtail = 0.5;
-    } else if (fish->vtail < -0.5) {
-        fish->vtail = -0.5;
-    }
-    segup = thrash * fish->vtail;
+       if (fish->vtail > 0.5) {
+               fish->vtail = 0.5;
+       } else if (fish->vtail < -0.5) {
+               fish->vtail = -0.5;
+       }
+       segup = thrash * fish->vtail;
 
-    P023[1] = iP023[1] + segup;
-    P024[1] = iP024[1] + segup;
-    P025[1] = iP025[1] + segup;
-    P026[1] = iP026[1] + segup;
-    P027[1] = iP027[1] + segup;
-    P028[1] = iP028[1] + segup;
-    P029[1] = iP029[1] + segup;
-    P030[1] = iP030[1] + segup;
-    P031[1] = iP031[1] + segup;
-    P032[1] = iP032[1] + segup;
-    P033[1] = iP033[1] + segup * 5.0;
-    P034[1] = iP034[1] + segup * 5.0;
-    P035[1] = iP035[1] + segup * 5.0;
-    P036[1] = iP036[1] + segup * 5.0;
-    P037[1] = iP037[1] + segup * 5.0;
-    P038[1] = iP038[1] + segup * 5.0;
-    P039[1] = iP039[1] + segup * 5.0;
-    P040[1] = iP040[1] + segup * 5.0;
-    P041[1] = iP041[1] + segup * 5.0;
-    P042[1] = iP042[1] + segup * 5.0;
-    P043[1] = iP043[1] + segup * 12.0;
-    P044[1] = iP044[1] + segup * 12.0;
-    P045[1] = iP045[1] + segup * 12.0;
-    P046[1] = iP046[1] + segup * 12.0;
-    P047[1] = iP047[1] + segup * 12.0;
-    P048[1] = iP048[1] + segup * 12.0;
-    P049[1] = iP049[1] + segup * 12.0;
-    P050[1] = iP050[1] + segup * 12.0;
-    P051[1] = iP051[1] + segup * 12.0;
-    P052[1] = iP052[1] + segup * 12.0;
-    P002[1] = iP002[1] + segup * 17.0;
-    P061[1] = iP061[1] + segup * 17.0;
-    P069[1] = iP069[1] + segup * 17.0;
-    P070[1] = iP070[1] + segup * 17.0;
+       P023[1] = iP023[1] + segup;
+       P024[1] = iP024[1] + segup;
+       P025[1] = iP025[1] + segup;
+       P026[1] = iP026[1] + segup;
+       P027[1] = iP027[1] + segup;
+       P028[1] = iP028[1] + segup;
+       P029[1] = iP029[1] + segup;
+       P030[1] = iP030[1] + segup;
+       P031[1] = iP031[1] + segup;
+       P032[1] = iP032[1] + segup;
+       P033[1] = iP033[1] + segup * 5.0;
+       P034[1] = iP034[1] + segup * 5.0;
+       P035[1] = iP035[1] + segup * 5.0;
+       P036[1] = iP036[1] + segup * 5.0;
+       P037[1] = iP037[1] + segup * 5.0;
+       P038[1] = iP038[1] + segup * 5.0;
+       P039[1] = iP039[1] + segup * 5.0;
+       P040[1] = iP040[1] + segup * 5.0;
+       P041[1] = iP041[1] + segup * 5.0;
+       P042[1] = iP042[1] + segup * 5.0;
+       P043[1] = iP043[1] + segup * 12.0;
+       P044[1] = iP044[1] + segup * 12.0;
+       P045[1] = iP045[1] + segup * 12.0;
+       P046[1] = iP046[1] + segup * 12.0;
+       P047[1] = iP047[1] + segup * 12.0;
+       P048[1] = iP048[1] + segup * 12.0;
+       P049[1] = iP049[1] + segup * 12.0;
+       P050[1] = iP050[1] + segup * 12.0;
+       P051[1] = iP051[1] + segup * 12.0;
+       P052[1] = iP052[1] + segup * 12.0;
+       P002[1] = iP002[1] + segup * 17.0;
+       P061[1] = iP061[1] + segup * 17.0;
+       P069[1] = iP069[1] + segup * 17.0;
+       P070[1] = iP070[1] + segup * 17.0;
 
-    glPushMatrix();
+       glPushMatrix();
 
-    glTranslatef(0.0, 0.0, -3000.0);
+       glTranslatef(0.0, 0.0, -3000.0);
 
-    glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0][0]);
-    n = 0;
-    if (mat[0][2] >= 0.0) {
-        n += 1;
-    }
-    if (mat[1][2] >= 0.0) {
-        n += 2;
-    }
-    if (mat[2][2] >= 0.0) {
-        n += 4;
-    }
-    glScalef(2.0, 1.0, 1.0);
+       glGetFloatv(GL_MODELVIEW_MATRIX, &mat[0][0]);
+       n = 0;
+       if (mat[0][2] >= 0.0) {
+               n += 1;
+       }
+       if (mat[1][2] >= 0.0) {
+               n += 2;
+       }
+       if (mat[2][2] >= 0.0) {
+               n += 4;
+       }
+       glScalef(2.0, 1.0, 1.0);
 
-    glEnable(GL_CULL_FACE);
-    switch (n) {
-    case 0:
-        Fish_1();
-        break;
-    case 1:
-        Fish_2();
-        break;
-    case 2:
-        Fish_3();
-        break;
-    case 3:
-        Fish_4();
-        break;
-    case 4:
-        Fish_5();
-        break;
-    case 5:
-        Fish_6();
-        break;
-    case 6:
-        Fish_7();
-        break;
-    case 7:
-        Fish_8();
-        break;
-    }
-    glDisable(GL_CULL_FACE);
+       glEnable(GL_CULL_FACE);
+       cap = wire ? GL_LINE_LOOP : GL_POLYGON;
+       switch (n) {
+               case 0:
+                       Fish_1(cap);
+                       break;
+               case 1:
+                       Fish_2(cap);
+                       break;
+               case 2:
+                       Fish_3(cap);
+                       break;
+               case 3:
+                       Fish_4(cap);
+                       break;
+               case 4:
+                       Fish_5(cap);
+                       break;
+               case 5:
+                       Fish_6(cap);
+                       break;
+               case 6:
+                       Fish_7(cap);
+                       break;
+               case 7:
+                       Fish_8(cap);
+                       break;
+       }
+       glDisable(GL_CULL_FACE);
 
-    glPopMatrix();
+       glPopMatrix();
 }
 #endif
index 518b43c979153df645dcc4cc221cc6f410ce0cd4..0848d46db259f49af1bbc477f034bee971106c63 100644 (file)
@@ -1,7 +1,7 @@
 /* atlantis --- Shows moving 3D sea animals */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)whale.c      1.1 98/05/13 xlockmore";
+static const char sccsid[] = "@(#)swim.c       1.3 98/06/18 xlockmore";
 
 #endif
 
@@ -73,9 +73,8 @@ static const char sccsid[] = "@(#)whale.c     1.1 98/05/13 xlockmore";
  * OpenGL(TM) is a trademark of Silicon Graphics, Inc.
  */
 
-#include <math.h>
-
 #ifdef STANDALONE
+# include <math.h>
 # include "xlockmoreI.h"       /* from the xscreensaver distribution */
 #else /* !STANDALONE */
 # include "xlock.h"            /* from the xlockmore distribution */
@@ -84,153 +83,152 @@ static const char sccsid[] = "@(#)whale.c 1.1 98/05/13 xlockmore";
 #ifdef USE_GL
 
 #include "atlantis.h"
-#include <stdlib.h>
 
 void
 FishTransform(fishRec * fish)
 {
 
-    glTranslatef(fish->y, fish->z, -fish->x);
-    glRotatef(-fish->psi, 0.0, 1.0, 0.0);
-    glRotatef(fish->theta, 1.0, 0.0, 0.0);
-    glRotatef(-fish->phi, 0.0, 0.0, 1.0);
+       glTranslatef(fish->y, fish->z, -fish->x);
+       glRotatef(-fish->psi, 0.0, 1.0, 0.0);
+       glRotatef(fish->theta, 1.0, 0.0, 0.0);
+       glRotatef(-fish->phi, 0.0, 0.0, 1.0);
 }
 
 void
-WhalePilot(fishRec * fish)
+WhalePilot(fishRec * fish, float whalespeed, Bool whaledir)
 {
 
-    fish->phi = -20.0;
-    fish->theta = 0.0;
-    fish->psi -= 0.5;
+       fish->phi = -20.0;
+       fish->theta = 0.0;
+       fish->psi += ((whaledir) ? -0.5 : 0.5);
 
-    fish->x += WHALESPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
-    fish->y += WHALESPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
-    fish->z += WHALESPEED * fish->v * sin(fish->theta / RAD);
+       fish->x += whalespeed * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
+       fish->y += whalespeed * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
+       fish->z += whalespeed * fish->v * sin(fish->theta / RAD);
 }
 
 void
-SharkPilot(fishRec * fish)
+SharkPilot(fishRec * fish, float sharkspeed)
 {
-    static int sign = 1;
-    float X, Y, Z, tpsi, ttheta, thetal;
-
-    fish->xt = 60000.0;
-    fish->yt = 0.0;
-    fish->zt = 0.0;
-
-    X = fish->xt - fish->x;
-    Y = fish->yt - fish->y;
-    Z = fish->zt - fish->z;
-
-    thetal = fish->theta;
-
-    ttheta = RAD * atan(Z / (sqrt(X * X + Y * Y)));
-
-    if (ttheta > fish->theta + 0.25) {
-        fish->theta += 0.5;
-    } else if (ttheta < fish->theta - 0.25) {
-        fish->theta -= 0.5;
-    }
-    if (fish->theta > 90.0) {
-        fish->theta = 90.0;
-    }
-    if (fish->theta < -90.0) {
-        fish->theta = -90.0;
-    }
-    fish->dtheta = fish->theta - thetal;
-
-    tpsi = RAD * atan2(Y, X);
-
-    fish->attack = 0;
-
-    if (fabs(tpsi - fish->psi) < 10.0) {
-        fish->attack = 1;
-    } else if (fabs(tpsi - fish->psi) < 45.0) {
-        if (fish->psi > tpsi) {
-            fish->psi -= 0.5;
-            if (fish->psi < -180.0) {
-                fish->psi += 360.0;
-            }
-        } else if (fish->psi < tpsi) {
-            fish->psi += 0.5;
-            if (fish->psi > 180.0) {
-                fish->psi -= 360.0;
-            }
-        }
-    } else {
-        if (NRAND(100) > 98) {
-            sign = 1 - sign;
-        }
-        fish->psi += sign;
-        if (fish->psi > 180.0) {
-            fish->psi -= 360.0;
-        }
-        if (fish->psi < -180.0) {
-            fish->psi += 360.0;
-        }
-    }
-
-    if (fish->attack) {
-        if (fish->v < 1.1) {
-            fish->spurt = 1;
-        }
-        if (fish->spurt) {
-            fish->v += 0.2;
-        }
-        if (fish->v > 5.0) {
-            fish->spurt = 0;
-        }
-        if ((fish->v > 1.0) && (!fish->spurt)) {
-            fish->v -= 0.2;
-        }
-    } else {
-        if (!(NRAND(400)) && (!fish->spurt)) {
-            fish->spurt = 1;
-        }
-        if (fish->spurt) {
-            fish->v += 0.05;
-        }
-        if (fish->v > 3.0) {
-            fish->spurt = 0;
-        }
-        if ((fish->v > 1.0) && (!fish->spurt)) {
-            fish->v -= 0.05;
-        }
-    }
-
-    fish->x += SHARKSPEED * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
-    fish->y += SHARKSPEED * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
-    fish->z += SHARKSPEED * fish->v * sin(fish->theta / RAD);
+       static int  sign = 1;
+       float       X, Y, Z, tpsi, ttheta, thetal;
+
+       fish->xt = 60000.0;
+       fish->yt = 0.0;
+       fish->zt = 0.0;
+
+       X = fish->xt - fish->x;
+       Y = fish->yt - fish->y;
+       Z = fish->zt - fish->z;
+
+       thetal = fish->theta;
+
+       ttheta = RAD * atan(Z / (sqrt(X * X + Y * Y)));
+
+       if (ttheta > fish->theta + 0.25) {
+               fish->theta += 0.5;
+       } else if (ttheta < fish->theta - 0.25) {
+               fish->theta -= 0.5;
+       }
+       if (fish->theta > 90.0) {
+               fish->theta = 90.0;
+       }
+       if (fish->theta < -90.0) {
+               fish->theta = -90.0;
+       }
+       fish->dtheta = fish->theta - thetal;
+
+       tpsi = RAD * atan2(Y, X);
+
+       fish->attack = 0;
+
+       if (fabs(tpsi - fish->psi) < 10.0) {
+               fish->attack = 1;
+       } else if (fabs(tpsi - fish->psi) < 45.0) {
+               if (fish->psi > tpsi) {
+                       fish->psi -= 0.5;
+                       if (fish->psi < -180.0) {
+                               fish->psi += 360.0;
+                       }
+               } else if (fish->psi < tpsi) {
+                       fish->psi += 0.5;
+                       if (fish->psi > 180.0) {
+                               fish->psi -= 360.0;
+                       }
+               }
+       } else {
+               if (NRAND(100) > 98) {
+                       sign = 1 - sign;
+               }
+               fish->psi += sign;
+               if (fish->psi > 180.0) {
+                       fish->psi -= 360.0;
+               }
+               if (fish->psi < -180.0) {
+                       fish->psi += 360.0;
+               }
+       }
+
+       if (fish->attack) {
+               if (fish->v < 1.1) {
+                       fish->spurt = 1;
+               }
+               if (fish->spurt) {
+                       fish->v += 0.2;
+               }
+               if (fish->v > 5.0) {
+                       fish->spurt = 0;
+               }
+               if ((fish->v > 1.0) && (!fish->spurt)) {
+                       fish->v -= 0.2;
+               }
+       } else {
+               if (!(NRAND(400)) && (!fish->spurt)) {
+                       fish->spurt = 1;
+               }
+               if (fish->spurt) {
+                       fish->v += 0.05;
+               }
+               if (fish->v > 3.0) {
+                       fish->spurt = 0;
+               }
+               if ((fish->v > 1.0) && (!fish->spurt)) {
+                       fish->v -= 0.05;
+               }
+       }
+
+       fish->x += sharkspeed * fish->v * cos(fish->psi / RAD) * cos(fish->theta / RAD);
+       fish->y += sharkspeed * fish->v * sin(fish->psi / RAD) * cos(fish->theta / RAD);
+       fish->z += sharkspeed * fish->v * sin(fish->theta / RAD);
 }
 
 void
-SharkMiss(atlantisstruct *ap, int i)
+SharkMiss(atlantisstruct * ap, int i)
 {
-    int j;
-    float avoid, thetal;
-    float X, Y, Z, R;
-
-    for (j = 0; j < NUM_SHARKS; j++) {
-        if (j != i) {
-            X = ap->sharks[j].x - ap->sharks[i].x;
-            Y = ap->sharks[j].y - ap->sharks[i].y;
-            Z = ap->sharks[j].z - ap->sharks[i].z;
-
-            R = sqrt(X * X + Y * Y + Z * Z);
-
-            avoid = 1.0;
-            thetal = ap->sharks[i].theta;
-
-            if (R < SHARKSIZE) {
-                if (Z > 0.0) {
-                    ap->sharks[i].theta -= avoid;
-                } else {
-                    ap->sharks[i].theta += avoid;
-                }
-            }
-            ap->sharks[i].dtheta += (ap->sharks[i].theta - thetal);
-        }
-    }
+       int         j;
+       float       avoid, thetal;
+       float       X, Y, Z, R;
+
+       for (j = 0; j < ap->num_sharks; j++) {
+               if (j != i) {
+                       X = ap->sharks[j].x - ap->sharks[i].x;
+                       Y = ap->sharks[j].y - ap->sharks[i].y;
+                       Z = ap->sharks[j].z - ap->sharks[i].z;
+
+                       R = sqrt(X * X + Y * Y + Z * Z);
+
+                       avoid = 1.0;
+                       thetal = ap->sharks[i].theta;
+
+                       if (R < ap->sharksize) {
+                               if (Z > 0.0) {
+                                       ap->sharks[i].theta -= avoid;
+                               } else {
+                                       ap->sharks[i].theta += avoid;
+                               }
+                       }
+                       ap->sharks[i].dtheta += (ap->sharks[i].theta - thetal);
+               }
+       }
 }
 #endif
index 4b1cba612993a597d8908c004739393c789f0707..afff1d381310290dd227010fb313975558d646cb 100644 (file)
@@ -1,13 +1,13 @@
 /* atlantis --- Shows moving 3D sea animals */
 
 #if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)whale.c      1.1 98/05/13 xlockmore";
+static const char sccsid[] = "@(#)whale.c      1.3 98/06/18 xlockmore";
 
 #endif
 
 /* Copyright (c) E. Lassauge, 1998. */
 
-/*
+/*-
  * Permission to use, copy, modify, and distribute this software and its
  * documentation for any purpose and without fee is hereby granted,
  * provided that the above copyright notice appear in all copies and that
@@ -36,7 +36,7 @@ static const char sccsid[] = "@(#)whale.c     1.1 98/05/13 xlockmore";
  *
  */
 
-/**
+/*-
  * (c) Copyright 1993, 1994, Silicon Graphics, Inc.
  * ALL RIGHTS RESERVED
  * Permission to use, copy, modify, and distribute this software for
@@ -79,10 +79,10 @@ static const char sccsid[] = "@(#)whale.c   1.1 98/05/13 xlockmore";
 #ifdef USE_GL
 
 #ifdef STANDALONE
+#include <math.h>
 #include <GL/glx.h>
 #endif
 
-#include <math.h>
 #include "atlantis.h"
 /* *INDENT-OFF* */
 static float N001[3] = {0.019249 ,0.011340 ,-0.999750};
@@ -405,1488 +405,1491 @@ static float P120[3] = {519.73, 128.36, 9163.26};
 static float P121[3] = {524.66, 141.43, 9138.62};
 /* *INDENT-ON* */
 
+
+
 static void
-Whale001(void)
+Whale001(GLenum cap)
 {
-
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N074);
-    glVertex3fv(P074);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N072);
-    glVertex3fv(P072);
-    glNormal3fv(N074);
-    glVertex3fv(P074);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N072);
-    glVertex3fv(P072);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N074);
-    glVertex3fv(P074);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N074);
-    glVertex3fv(P074);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N070);
-    glVertex3fv(P070);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N076);
-    glVertex3fv(P076);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N068);
-    glVertex3fv(P068);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N010);
-    glVertex3fv(P010);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N074);
+       glVertex3fv(P074);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N072);
+       glVertex3fv(P072);
+       glNormal3fv(N074);
+       glVertex3fv(P074);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N072);
+       glVertex3fv(P072);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N074);
+       glVertex3fv(P074);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N074);
+       glVertex3fv(P074);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N070);
+       glVertex3fv(P070);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N076);
+       glVertex3fv(P076);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N068);
+       glVertex3fv(P068);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N010);
+       glVertex3fv(P010);
+       glEnd();
 }
 
 static void
-Whale002(void)
+Whale002(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glNormal3fv(N073);
-    glVertex3fv(P073);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N071);
-    glVertex3fv(P071);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N073);
-    glVertex3fv(P073);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N009);
-    glVertex3fv(P009);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N011);
-    glVertex3fv(P011);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N073);
-    glVertex3fv(P073);
-    glNormal3fv(N075);
-    glVertex3fv(P075);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N069);
-    glVertex3fv(P069);
-    glNormal3fv(N071);
-    glVertex3fv(P071);
-    glNormal3fv(N073);
-    glVertex3fv(P073);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glNormal3fv(N073);
+       glVertex3fv(P073);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N071);
+       glVertex3fv(P071);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N073);
+       glVertex3fv(P073);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N009);
+       glVertex3fv(P009);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N011);
+       glVertex3fv(P011);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N073);
+       glVertex3fv(P073);
+       glNormal3fv(N075);
+       glVertex3fv(P075);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N069);
+       glVertex3fv(P069);
+       glNormal3fv(N071);
+       glVertex3fv(P071);
+       glNormal3fv(N073);
+       glVertex3fv(P073);
+       glEnd();
 }
 
 static void
-Whale003(void)
+Whale003(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N001);
-    glVertex3fv(P001);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N001);
+       glVertex3fv(P001);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glEnd();
 }
 
 static void
-Whale004(void)
+Whale004(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N015);
-    glVertex3fv(P015);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N016);
-    glVertex3fv(P016);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N017);
-    glVertex3fv(P017);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N014);
-    glVertex3fv(P014);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N013);
-    glVertex3fv(P013);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N018);
-    glVertex3fv(P018);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N019);
-    glVertex3fv(P019);
-    glNormal3fv(N012);
-    glVertex3fv(P012);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N015);
+       glVertex3fv(P015);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N016);
+       glVertex3fv(P016);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N017);
+       glVertex3fv(P017);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N014);
+       glVertex3fv(P014);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N013);
+       glVertex3fv(P013);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N018);
+       glVertex3fv(P018);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N019);
+       glVertex3fv(P019);
+       glNormal3fv(N012);
+       glVertex3fv(P012);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glEnd();
 }
 
 static void
-Whale005(void)
+Whale005(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N022);
-    glVertex3fv(P022);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N023);
-    glVertex3fv(P023);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N024);
-    glVertex3fv(P024);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N021);
-    glVertex3fv(P021);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N020);
-    glVertex3fv(P020);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N025);
-    glVertex3fv(P025);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N026);
-    glVertex3fv(P026);
-    glNormal3fv(N027);
-    glVertex3fv(P027);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N022);
+       glVertex3fv(P022);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N023);
+       glVertex3fv(P023);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N024);
+       glVertex3fv(P024);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N021);
+       glVertex3fv(P021);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N020);
+       glVertex3fv(P020);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N025);
+       glVertex3fv(P025);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N026);
+       glVertex3fv(P026);
+       glNormal3fv(N027);
+       glVertex3fv(P027);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glEnd();
 }
 
 static void
-Whale006(void)
+Whale006(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N093);
-    glVertex3fv(P093);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N093);
-    glVertex3fv(P093);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N091);
-    glVertex3fv(P091);
-    glNormal3fv(N092);
-    glVertex3fv(P092);
-    glNormal3fv(N094);
-    glVertex3fv(P094);
-    glNormal3fv(N095);
-    glVertex3fv(P095);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N093);
+       glVertex3fv(P093);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N093);
+       glVertex3fv(P093);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N091);
+       glVertex3fv(P091);
+       glNormal3fv(N092);
+       glVertex3fv(P092);
+       glNormal3fv(N094);
+       glVertex3fv(P094);
+       glNormal3fv(N095);
+       glVertex3fv(P095);
+       glEnd();
 }
 
 static void
-Whale007(void)
+Whale007(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N030);
-    glVertex3fv(P030);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N029);
-    glVertex3fv(P029);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N028);
-    glVertex3fv(P028);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N035);
-    glVertex3fv(P035);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N034);
-    glVertex3fv(P034);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N031);
-    glVertex3fv(P031);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N032);
-    glVertex3fv(P032);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N033);
-    glVertex3fv(P033);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N030);
+       glVertex3fv(P030);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N029);
+       glVertex3fv(P029);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N028);
+       glVertex3fv(P028);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N035);
+       glVertex3fv(P035);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N034);
+       glVertex3fv(P034);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N031);
+       glVertex3fv(P031);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N032);
+       glVertex3fv(P032);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N033);
+       glVertex3fv(P033);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glEnd();
 }
 
 static void
-Whale008(void)
+Whale008(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N043);
-    glVertex3fv(P043);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N042);
-    glVertex3fv(P042);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N036);
-    glVertex3fv(P036);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N041);
-    glVertex3fv(P041);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N040);
-    glVertex3fv(P040);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N037);
-    glVertex3fv(P037);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N038);
-    glVertex3fv(P038);
-    glNormal3fv(N039);
-    glVertex3fv(P039);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N043);
+       glVertex3fv(P043);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N042);
+       glVertex3fv(P042);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N036);
+       glVertex3fv(P036);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N041);
+       glVertex3fv(P041);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N040);
+       glVertex3fv(P040);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N037);
+       glVertex3fv(P037);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N038);
+       glVertex3fv(P038);
+       glNormal3fv(N039);
+       glVertex3fv(P039);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glEnd();
 }
 
 static void
-Whale009(void)
+Whale009(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N051);
-    glVertex3fv(P051);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N044);
-    glVertex3fv(P044);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N050);
-    glVertex3fv(P050);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N049);
-    glVertex3fv(P049);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N048);
-    glVertex3fv(P048);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N045);
-    glVertex3fv(P045);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N046);
-    glVertex3fv(P046);
-    glNormal3fv(N047);
-    glVertex3fv(P047);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N051);
+       glVertex3fv(P051);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N044);
+       glVertex3fv(P044);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N050);
+       glVertex3fv(P050);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N049);
+       glVertex3fv(P049);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N048);
+       glVertex3fv(P048);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N045);
+       glVertex3fv(P045);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N046);
+       glVertex3fv(P046);
+       glNormal3fv(N047);
+       glVertex3fv(P047);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
 }
 
 static void
-Whale010(void)
+Whale010(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N080);
-    glVertex3fv(P080);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N090);
-    glVertex3fv(P090);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N080);
-    glVertex3fv(P080);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N081);
-    glVertex3fv(P081);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N085);
-    glVertex3fv(P085);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N083);
-    glVertex3fv(P083);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N087);
-    glVertex3fv(P087);
-    glNormal3fv(N077);
-    glVertex3fv(P077);
-    glNormal3fv(N090);
-    glVertex3fv(P090);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N080);
+       glVertex3fv(P080);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N090);
+       glVertex3fv(P090);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N080);
+       glVertex3fv(P080);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N081);
+       glVertex3fv(P081);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N085);
+       glVertex3fv(P085);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N083);
+       glVertex3fv(P083);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N087);
+       glVertex3fv(P087);
+       glNormal3fv(N077);
+       glVertex3fv(P077);
+       glNormal3fv(N090);
+       glVertex3fv(P090);
+       glEnd();
 }
 
 static void
-Whale011(void)
+Whale011(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N082);
-    glVertex3fv(P082);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N088);
-    glVertex3fv(P088);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N089);
-    glVertex3fv(P089);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N086);
-    glVertex3fv(P086);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N078);
-    glVertex3fv(P078);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N084);
-    glVertex3fv(P084);
-    glNormal3fv(N082);
-    glVertex3fv(P082);
-    glNormal3fv(N079);
-    glVertex3fv(P079);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N082);
+       glVertex3fv(P082);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N088);
+       glVertex3fv(P088);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N089);
+       glVertex3fv(P089);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N086);
+       glVertex3fv(P086);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N078);
+       glVertex3fv(P078);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N084);
+       glVertex3fv(P084);
+       glNormal3fv(N082);
+       glVertex3fv(P082);
+       glNormal3fv(N079);
+       glVertex3fv(P079);
+       glEnd();
 }
 
 static void
-Whale012(void)
+Whale012(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N059);
-    glVertex3fv(P059);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N058);
-    glVertex3fv(P058);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N057);
-    glVertex3fv(P057);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N056);
-    glVertex3fv(P056);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N053);
-    glVertex3fv(P053);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N052);
-    glVertex3fv(P052);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N059);
+       glVertex3fv(P059);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N058);
+       glVertex3fv(P058);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N057);
+       glVertex3fv(P057);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N056);
+       glVertex3fv(P056);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N053);
+       glVertex3fv(P053);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N052);
+       glVertex3fv(P052);
+       glEnd();
 }
 
 static void
-Whale013(void)
+Whale013(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N096);
-    glVertex3fv(P096);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glNormal3fv(N096);
-    glVertex3fv(P096);
-    glNormal3fv(N098);
-    glVertex3fv(P098);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N066);
-    glVertex3fv(P066);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N067);
-    glVertex3fv(P067);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N096);
-    glVertex3fv(P096);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N060);
-    glVertex3fv(P060);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N096);
-    glVertex3fv(P096);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N096);
-    glVertex3fv(P096);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glNormal3fv(N098);
-    glVertex3fv(P098);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N065);
-    glVertex3fv(P065);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N097);
-    glVertex3fv(P097);
-    glNormal3fv(N099);
-    glVertex3fv(P099);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P005);
-    glVertex3fv(P006);
-    glVertex3fv(P099);
-    glVertex3fv(P098);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N096);
+       glVertex3fv(P096);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glNormal3fv(N096);
+       glVertex3fv(P096);
+       glNormal3fv(N098);
+       glVertex3fv(P098);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N066);
+       glVertex3fv(P066);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N067);
+       glVertex3fv(P067);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N096);
+       glVertex3fv(P096);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N060);
+       glVertex3fv(P060);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N096);
+       glVertex3fv(P096);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N096);
+       glVertex3fv(P096);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glNormal3fv(N098);
+       glVertex3fv(P098);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N065);
+       glVertex3fv(P065);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N097);
+       glVertex3fv(P097);
+       glNormal3fv(N099);
+       glVertex3fv(P099);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P005);
+       glVertex3fv(P006);
+       glVertex3fv(P099);
+       glVertex3fv(P098);
+       glEnd();
 }
 
 static void
-Whale014(void)
+Whale014(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N004);
-    glVertex3fv(P004);
-    glNormal3fv(N005);
-    glVertex3fv(P005);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P006);
-    glVertex3fv(P005);
-    glVertex3fv(P004);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N006);
-    glVertex3fv(P006);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N008);
-    glVertex3fv(P008);
-    glNormal3fv(N004);
-    glVertex3fv(P004);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N004);
-    glVertex3fv(P004);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N004);
+       glVertex3fv(P004);
+       glNormal3fv(N005);
+       glVertex3fv(P005);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P006);
+       glVertex3fv(P005);
+       glVertex3fv(P004);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N006);
+       glVertex3fv(P006);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N008);
+       glVertex3fv(P008);
+       glNormal3fv(N004);
+       glVertex3fv(P004);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N004);
+       glVertex3fv(P004);
+       glEnd();
 }
 
 static void
-Whale015(void)
+Whale015(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N055);
-    glVertex3fv(P055);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N003);
-    glVertex3fv(P003);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N054);
-    glVertex3fv(P054);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N063);
-    glVertex3fv(P063);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glNormal3fv(N100);
-    glVertex3fv(P100);
-    glNormal3fv(N002);
-    glVertex3fv(P002);
-    glNormal3fv(N062);
-    glVertex3fv(P062);
-    glEnd();
+       glBegin(cap);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N055);
+       glVertex3fv(P055);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N003);
+       glVertex3fv(P003);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N054);
+       glVertex3fv(P054);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N063);
+       glVertex3fv(P063);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glEnd();
+       glBegin(cap);
+       glNormal3fv(N100);
+       glVertex3fv(P100);
+       glNormal3fv(N002);
+       glVertex3fv(P002);
+       glNormal3fv(N062);
+       glVertex3fv(P062);
+       glEnd();
 }
 
 static void
-Whale016(void)
+Whale016(GLenum cap)
 {
-    glBegin(GL_POLYGON);
-    glVertex3fv(P104);
-    glVertex3fv(P105);
-    glVertex3fv(P106);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P107);
-    glVertex3fv(P108);
-    glVertex3fv(P109);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P110);
-    glVertex3fv(P111);
-    glVertex3fv(P112);
-    glVertex3fv(P113);
-    glVertex3fv(P114);
-    glVertex3fv(P115);
-    glEnd();
-    glBegin(GL_POLYGON);
-    glVertex3fv(P116);
-    glVertex3fv(P117);
-    glVertex3fv(P118);
-    glVertex3fv(P119);
-    glVertex3fv(P120);
-    glVertex3fv(P121);
-    glEnd();
+       glBegin(cap);
+       glVertex3fv(P104);
+       glVertex3fv(P105);
+       glVertex3fv(P106);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P107);
+       glVertex3fv(P108);
+       glVertex3fv(P109);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P110);
+       glVertex3fv(P111);
+       glVertex3fv(P112);
+       glVertex3fv(P113);
+       glVertex3fv(P114);
+       glVertex3fv(P115);
+       glEnd();
+       glBegin(cap);
+       glVertex3fv(P116);
+       glVertex3fv(P117);
+       glVertex3fv(P118);
+       glVertex3fv(P119);
+       glVertex3fv(P120);
+       glVertex3fv(P121);
+       glEnd();
 }
 
 void
-DrawWhale(fishRec * fish)
+DrawWhale(fishRec * fish, int wire)
 {
-    float seg0, seg1, seg2, seg3, seg4, seg5, seg6, seg7;
-    float pitch, thrash, chomp;
+       float       seg0, seg1, seg2, seg3, seg4, seg5, seg6, seg7;
+       float       pitch, thrash, chomp;
+       GLenum      cap;
 
-    fish->htail = (int) (fish->htail - (int) (5.0 * fish->v)) % 360;
+       fish->htail = (int) (fish->htail - (int) (5.0 * fish->v)) % 360;
 
-    thrash = 70.0 * fish->v;
+       thrash = 70.0 * fish->v;
 
-    seg0 = 1.5 * thrash * sin((fish->htail) * RRAD);
-    seg1 = 2.5 * thrash * sin((fish->htail + 10.0) * RRAD);
-    seg2 = 3.7 * thrash * sin((fish->htail + 15.0) * RRAD);
-    seg3 = 4.8 * thrash * sin((fish->htail + 23.0) * RRAD);
-    seg4 = 6.0 * thrash * sin((fish->htail + 28.0) * RRAD);
-    seg5 = 6.5 * thrash * sin((fish->htail + 35.0) * RRAD);
-    seg6 = 6.5 * thrash * sin((fish->htail + 40.0) * RRAD);
-    seg7 = 6.5 * thrash * sin((fish->htail + 55.0) * RRAD);
+       seg0 = 1.5 * thrash * sin((fish->htail) * RRAD);
+       seg1 = 2.5 * thrash * sin((fish->htail + 10.0) * RRAD);
+       seg2 = 3.7 * thrash * sin((fish->htail + 15.0) * RRAD);
+       seg3 = 4.8 * thrash * sin((fish->htail + 23.0) * RRAD);
+       seg4 = 6.0 * thrash * sin((fish->htail + 28.0) * RRAD);
+       seg5 = 6.5 * thrash * sin((fish->htail + 35.0) * RRAD);
+       seg6 = 6.5 * thrash * sin((fish->htail + 40.0) * RRAD);
+       seg7 = 6.5 * thrash * sin((fish->htail + 55.0) * RRAD);
 
-    pitch = fish->v * sin((fish->htail - 160.0) * RRAD);
+       pitch = fish->v * sin((fish->htail - 160.0) * RRAD);
 
-    chomp = 0.0;
-    if (fish->v > 2.0) {
-        chomp = -(fish->v - 2.0) * 200.0;
-    }
-    P012[1] = iP012[1] + seg5;
-    P013[1] = iP013[1] + seg5;
-    P014[1] = iP014[1] + seg5;
-    P015[1] = iP015[1] + seg5;
-    P016[1] = iP016[1] + seg5;
-    P017[1] = iP017[1] + seg5;
-    P018[1] = iP018[1] + seg5;
-    P019[1] = iP019[1] + seg5;
+       chomp = 0.0;
+       if (fish->v > 2.0) {
+               chomp = -(fish->v - 2.0) * 200.0;
+       }
+       P012[1] = iP012[1] + seg5;
+       P013[1] = iP013[1] + seg5;
+       P014[1] = iP014[1] + seg5;
+       P015[1] = iP015[1] + seg5;
+       P016[1] = iP016[1] + seg5;
+       P017[1] = iP017[1] + seg5;
+       P018[1] = iP018[1] + seg5;
+       P019[1] = iP019[1] + seg5;
 
-    P020[1] = iP020[1] + seg4;
-    P021[1] = iP021[1] + seg4;
-    P022[1] = iP022[1] + seg4;
-    P023[1] = iP023[1] + seg4;
-    P024[1] = iP024[1] + seg4;
-    P025[1] = iP025[1] + seg4;
-    P026[1] = iP026[1] + seg4;
-    P027[1] = iP027[1] + seg4;
+       P020[1] = iP020[1] + seg4;
+       P021[1] = iP021[1] + seg4;
+       P022[1] = iP022[1] + seg4;
+       P023[1] = iP023[1] + seg4;
+       P024[1] = iP024[1] + seg4;
+       P025[1] = iP025[1] + seg4;
+       P026[1] = iP026[1] + seg4;
+       P027[1] = iP027[1] + seg4;
 
-    P028[1] = iP028[1] + seg2;
-    P029[1] = iP029[1] + seg2;
-    P030[1] = iP030[1] + seg2;
-    P031[1] = iP031[1] + seg2;
-    P032[1] = iP032[1] + seg2;
-    P033[1] = iP033[1] + seg2;
-    P034[1] = iP034[1] + seg2;
-    P035[1] = iP035[1] + seg2;
+       P028[1] = iP028[1] + seg2;
+       P029[1] = iP029[1] + seg2;
+       P030[1] = iP030[1] + seg2;
+       P031[1] = iP031[1] + seg2;
+       P032[1] = iP032[1] + seg2;
+       P033[1] = iP033[1] + seg2;
+       P034[1] = iP034[1] + seg2;
+       P035[1] = iP035[1] + seg2;
 
-    P036[1] = iP036[1] + seg1;
-    P037[1] = iP037[1] + seg1;
-    P038[1] = iP038[1] + seg1;
-    P039[1] = iP039[1] + seg1;
-    P040[1] = iP040[1] + seg1;
-    P041[1] = iP041[1] + seg1;
-    P042[1] = iP042[1] + seg1;
-    P043[1] = iP043[1] + seg1;
+       P036[1] = iP036[1] + seg1;
+       P037[1] = iP037[1] + seg1;
+       P038[1] = iP038[1] + seg1;
+       P039[1] = iP039[1] + seg1;
+       P040[1] = iP040[1] + seg1;
+       P041[1] = iP041[1] + seg1;
+       P042[1] = iP042[1] + seg1;
+       P043[1] = iP043[1] + seg1;
 
-    P044[1] = iP044[1] + seg0;
-    P045[1] = iP045[1] + seg0;
-    P046[1] = iP046[1] + seg0;
-    P047[1] = iP047[1] + seg0;
-    P048[1] = iP048[1] + seg0;
-    P049[1] = iP049[1] + seg0;
-    P050[1] = iP050[1] + seg0;
-    P051[1] = iP051[1] + seg0;
+       P044[1] = iP044[1] + seg0;
+       P045[1] = iP045[1] + seg0;
+       P046[1] = iP046[1] + seg0;
+       P047[1] = iP047[1] + seg0;
+       P048[1] = iP048[1] + seg0;
+       P049[1] = iP049[1] + seg0;
+       P050[1] = iP050[1] + seg0;
+       P051[1] = iP051[1] + seg0;
 
-    P009[1] = iP009[1] + seg6;
-    P010[1] = iP010[1] + seg6;
-    P075[1] = iP075[1] + seg6;
-    P076[1] = iP076[1] + seg6;
+       P009[1] = iP009[1] + seg6;
+       P010[1] = iP010[1] + seg6;
+       P075[1] = iP075[1] + seg6;
+       P076[1] = iP076[1] + seg6;
 
-    P001[1] = iP001[1] + seg7;
-    P011[1] = iP011[1] + seg7;
-    P068[1] = iP068[1] + seg7;
-    P069[1] = iP069[1] + seg7;
-    P070[1] = iP070[1] + seg7;
-    P071[1] = iP071[1] + seg7;
-    P072[1] = iP072[1] + seg7;
-    P073[1] = iP073[1] + seg7;
-    P074[1] = iP074[1] + seg7;
+       P001[1] = iP001[1] + seg7;
+       P011[1] = iP011[1] + seg7;
+       P068[1] = iP068[1] + seg7;
+       P069[1] = iP069[1] + seg7;
+       P070[1] = iP070[1] + seg7;
+       P071[1] = iP071[1] + seg7;
+       P072[1] = iP072[1] + seg7;
+       P073[1] = iP073[1] + seg7;
+       P074[1] = iP074[1] + seg7;
 
-    P091[1] = iP091[1] + seg3 * 1.1;
-    P092[1] = iP092[1] + seg3;
-    P093[1] = iP093[1] + seg3;
-    P094[1] = iP094[1] + seg3;
-    P095[1] = iP095[1] + seg3 * 0.9;
+       P091[1] = iP091[1] + seg3 * 1.1;
+       P092[1] = iP092[1] + seg3;
+       P093[1] = iP093[1] + seg3;
+       P094[1] = iP094[1] + seg3;
+       P095[1] = iP095[1] + seg3 * 0.9;
 
-    P099[1] = iP099[1] + chomp;
-    P098[1] = iP098[1] + chomp;
-    P064[1] = iP064[1] + chomp;
-    P061[1] = iP061[1] + chomp;
-    P097[1] = iP097[1] + chomp;
-    P096[1] = iP096[1] + chomp;
+       P099[1] = iP099[1] + chomp;
+       P098[1] = iP098[1] + chomp;
+       P064[1] = iP064[1] + chomp;
+       P061[1] = iP061[1] + chomp;
+       P097[1] = iP097[1] + chomp;
+       P096[1] = iP096[1] + chomp;
 
-    glPushMatrix();
+       glPushMatrix();
 
-    glRotatef(pitch, 1.0, 0.0, 0.0);
+       glRotatef(pitch, 1.0, 0.0, 0.0);
 
-    glTranslatef(0.0, 0.0, 8000.0);
+       glTranslatef(0.0, 0.0, 8000.0);
 
-    glRotatef(180.0, 0.0, 1.0, 0.0);
+       glRotatef(180.0, 0.0, 1.0, 0.0);
 
-    glScalef(3.0, 3.0, 3.0);
+       glScalef(3.0, 3.0, 3.0);
 
-    glEnable(GL_CULL_FACE);
+       glEnable(GL_CULL_FACE);
 
-    Whale001();
-    Whale002();
-    Whale003();
-    Whale004();
-    Whale005();
-    Whale006();
-    Whale007();
-    Whale008();
-    Whale009();
-    Whale010();
-    Whale011();
-    Whale012();
-    Whale013();
-    Whale014();
-    Whale015();
-    Whale016();
+       cap = wire ? GL_LINE_LOOP : GL_POLYGON;
+       Whale001(cap);
+       Whale002(cap);
+       Whale003(cap);
+       Whale004(cap);
+       Whale005(cap);
+       Whale006(cap);
+       Whale007(cap);
+       Whale008(cap);
+       Whale009(cap);
+       Whale010(cap);
+       Whale011(cap);
+       Whale012(cap);
+       Whale013(cap);
+       Whale014(cap);
+       Whale015(cap);
+       Whale016(cap);
 
-    glDisable(GL_CULL_FACE);
+       glDisable(GL_CULL_FACE);
 
-    glPopMatrix();
+       glPopMatrix();
 }
 #endif
index d8cfd7a6bc40252ca213827669a3ab0753f791ef..828128617a052a824b97ee15bc34cb05373b359b 100644 (file)
@@ -1,5 +1,5 @@
 /* xlock-gc.c --- xscreensaver compatibility layer for xlockmore GL modules.
- * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -11,7 +11,7 @@
  *
  * This file, along with xlockmore.h, make it possible to compile an xlockmore
  * GL module into a standalone program, and thus use it with xscreensaver.
- * By Jamie Zawinski <jwz@netscape.com> on 31-May-97.
+ * By Jamie Zawinski <jwz@jwz.org> on 31-May-97.
  */
 
 #include <stdio.h>
index 8619c9ffb88d0b7958c346d9e3de673aa091d81f..233708e6913fc714ae1d0845792d42a3198a47bb 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index e7f4c3da5fd1792f813d60604970c295cc9ffbb5..d8e5b522508f8f0a701a3a13c79c59e176a39fb5 100644 (file)
@@ -78,4 +78,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 11-Jun-97.
+Jamie Zawinski <jwz@jwz.org>, 11-Jun-97.
index 528bb1b9fc2cf63a03bfa0545199fe47dea5894b..6ed41b8686e5d19ef5c35f1e685941ab7cc5d8bd 100644 (file)
@@ -20,7 +20,7 @@ static const char sccsid[] = "@(#)grav.c      4.00 97/01/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision history:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 11-Jul-94: color version
  * 06-Oct-93: by Greg Bowering <greg@smug.student.adelaide.edu.au>
  */
index 2a53938dddcfd70fd4b81117e74fe31f6e9b28bd..7cd42cb69dab2b45ad2f6e2daac75a74145fd7bd 100644 (file)
@@ -71,4 +71,4 @@ supporting documentation.
 Greg Bowering <greg@smug.student.adelaide.edu.au>, 1993.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 0ffb332a4e2d75c6fd3dc46e3c5a2fab20080728..b2ddec4c0593764330629609035ae0cf70004035 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 8638112366466d9b1ab6ad21e623dff00af2eee6..0b761ccd5824f4d9dbbc00c0da64e6b27a39bcaa 100644 (file)
@@ -49,4 +49,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
index f159a02a68d315ff4328ea92c6a7590a9bcdd00d..474f0bc67962fede585b0fd22ae39359e17d01d5 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1993, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 0d3d4e01f3471f9ad2418d80fbc5aa21a972473f..a499357ad1d726d1af79a8809660592d36e128c6 100644 (file)
@@ -77,4 +77,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 6-jul-93.
+Jamie Zawinski <jwz@jwz.org>, 6-jul-93.
index 97de40dc7fb360ddd50a89b3ba5aba9659bb2a46..c2d81fa22dfd6785931160d3c8e03ed688e12135 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index abc0a827fca48cdf4f928221887784884de09504..2c1c3e392f82eca2ffd8650d74fed3415d14c02d 100644 (file)
@@ -58,6 +58,6 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
 Screen eraser improved by Johannes Keukelaar <johannes@nada.kth.se>, 
  18-sep-97.
index cb663ac33a0603791ed884131df85b6b080ccce6..c762a162f71b044f7a6c4d43538c7998cb0b05ec 100644 (file)
@@ -21,7 +21,7 @@ static const char sccsid[] = "@(#)hop.c       4.02 97/04/01 xlockmore";
  *
  * Revision History:
  * Changes of David Bagley <bagleyd@bigfoot.com>
- * 10-May-97: jwz@netscape.com: ported from xlockmore 4.03a10 to be a 
+ * 10-May-97: jwz@jwz.org: ported from xlockmore 4.03a10 to be a 
  *                       standalone program and thus usable with xscreensaver
  *                       (I threw away my 1992 port and started over.)
  * 27-Jul-95: added Peter de Jong's hop from Scientific American
index bbb15be0df5963146c469e85fa5d78d1d64c6516..d36a360b555c31fc23656d85cd937a10a85c5754 100644 (file)
@@ -75,4 +75,4 @@ supporting documentation.
 Patrick J. Naughton <naughton@eng.sun.com>, 23-mar-88.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92, and again on 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92, and again on 10-May-97.
index 6ad94a83c9c28ac09f455ad56d6751084f306209..560f1306df32699c6fac0fdd0bacfdc77a57515a 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index daa66899cc8aae69612f10ae562e47fcba9632ea..4c5f8f9d096c20af6ef0261178dd9e8105a42456 100644 (file)
@@ -90,4 +90,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 6-dec-92.
+Jamie Zawinski <jwz@jwz.org>, 6-dec-92.
index b29f8e349d4671e05f011facfbcb55ab07c9cbe7..3bccf872073170a619a1d67f8d570a63a0da3b97 100644 (file)
@@ -21,7 +21,7 @@ static const char sccsid[] = "@(#)ifs.c          4.02 97/04/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  *                       Made it render into an offscreen bitmap and then copy
  *                       that onto the screen, to reduce flicker.
  */
index 39e12d150bd900d604bb50d7ffd2f14a3adf63e8..2d04eef31be42606ea6de41f029b53e847fecc5f 100644 (file)
@@ -56,4 +56,4 @@ supporting documentation.
 Massimino Pascal <Pascal.Massimon@ens.fr>, 1997.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
diff --git a/hacks/images/atari.xbm b/hacks/images/atari.xbm
new file mode 100644 (file)
index 0000000..3b8a7d2
--- /dev/null
@@ -0,0 +1,13 @@
+#define atari_width 34
+#define atari_height 28
+static char atari_bits[] = {
+ 0x00,0x0f,0x00,0x00,0xfc,0x00,0x0f,0x00,0x00,0xfc,0xcc,0x30,0x00,0x00,0xfc,
+ 0xcc,0x30,0x00,0x00,0xfc,0x00,0xc0,0x00,0x00,0xfc,0x00,0xc0,0x00,0x00,0xfc,
+ 0xc3,0x00,0x03,0x00,0xfc,0xc3,0x00,0x03,0x00,0xfc,0x30,0xf0,0x3f,0x00,0xfc,
+ 0x30,0xf0,0x3f,0x00,0xfc,0x00,0xf0,0x3f,0x00,0xfc,0x00,0xf0,0x3f,0x00,0xfc,
+ 0x00,0xff,0xff,0x03,0xfc,0x00,0xff,0xff,0x03,0xfc,0xc0,0xff,0xff,0x0f,0xfc,
+ 0xc0,0xff,0xff,0x0f,0xfc,0xc0,0xf3,0xff,0x0f,0xfc,0xc0,0xf3,0xff,0x0f,0xfc,
+ 0xf0,0xff,0xff,0x3f,0xfc,0xf0,0xff,0xff,0x3f,0xfc,0xf0,0xff,0xcf,0x3f,0xfc,
+ 0xf0,0xff,0xcf,0x3f,0xfc,0xc0,0xff,0xcf,0x0f,0xfc,0xc0,0xff,0xcf,0x0f,0xfc,
+ 0xc0,0xff,0xf3,0x0f,0xfc,0xc0,0xff,0xf7,0x0f,0xfc,0x00,0xff,0xff,0x03,0xfc,
+ 0x00,0xff,0xff,0x03,0xfc};
diff --git a/hacks/images/lament.xpm b/hacks/images/lament.xpm
new file mode 100644 (file)
index 0000000..96c4dbd
--- /dev/null
@@ -0,0 +1,791 @@
+/* XPM */
+static char *lament_faces[] = {
+/* width height num_colors chars_per_pixel */
+"   128   768       16            1",
+/* colors */
+". c #c7c913",
+"# c #241d15",
+"a c #5e5a1b",
+"b c #6a6a19",
+"c c #e7d60b",
+"d c #fceb05",
+"e c #d8c610",
+"f c #3e3a1b",
+"g c #2c2b16",
+"h c #88891a",
+"i c #99971a",
+"j c #a8a918",
+"k c #7c781b",
+"l c #050506",
+"m c #b9b817",
+"n c #4d4c1a",
+/* pixels */
+"lf........eeee.e.e.e..eee.eeee.ee..allfkkkbabaabnknabbbbbhhhhallajiiijiiiihmiiijiihjiiiillimmjjjijijjjjjjiiijjmmmmmjmm....ee.lll",
+"#lacdddccdicmjdbdedcdccjcjdjcjccmddcllgdddejd.ceceeddded.d.ddelliddddec.cmcjchchciejeddjlfdddicbeedi.h.ecjhejc..kchcbehedddeflll",
+"cnlbdddddddddddddddddddcdddedcdc.dddflleddcmd.dedc.dddidmdmddmlliddddcdcdmdjd.cje.ejeddnlidddec.ccdmcje.ceichcmdidhcieieddc#llia",
+"cdhlhdic.#####edekk#ggg##ggggggggkdccjiecdhgggggggggggfgggfcdcmmcdcngggggggfgfgfggfh.mdjic.cgggfffggggfgffgfnncdddbnnadijd#lljda",
+"edde.ki..bllll.dmljglllllllllllll#ecdkaaemjllllllllllll#iglee.nfmmelllllllllllllllljmmbnicekllllllllllllllllfmeijilllkb..kighcda",
+"edddblncbdklllkd.lgclllllllllllfbcde.hllkjdgllllllllllllkdjdjmllhdc#llllllllllllll#d.cll.lmfllllllllllllllliddllh#llidicglbdddda",
+"edd.dblgckcilllcdhmj.#lllllll.c.ajddcell#dhjllllk.i#lllg.j.cejllibeelllllllllllllladcilfdedmmjnllllllllllfedde..hllhdac#ll.cacda",
+".iemcealgc.mbllidddg#jllllllgcddcmjjccfllme.llfmefl#lllnededkmlli.cd#lllllllllllll.nc#lijmi.cajki#llllllk.kf#lljllkmjeallkjjckjn",
+"edjf.kdblgcdhhlbdd.ll.mlllamcecdmdmhde.llgmhnn.dffmcnll#cdbcdjllibeeillllllllllllfdcilleddbaah.dhmllllliellllllhlicecgllimcc#cdn",
+".hmlfdcdhlgekch#edc#f..jllecdj#iadddd.dgll.mehlhecn#bgll#cmddillih.ndcjlllllllllliadflhbhddcbmdkbdchlg.ddcccjfhbhdhc#llmebeg#hmn",
+"e.jllgcmdal#ebcbnddmckihflkddd.eaeddde.bllkmdb#.cenmhllllkhdeilli..gddd.lllllllllcjcllc.ddddddd#ljdcacddccemedd.ckegllh.hc#ll.cn",
+".jilllfdcdblg.cckjdddailjnd.iedddddddddell#dddc#hddif#ll#aedijllhaml.dddflllllllbmbal#.nddddddellbacdd.nlkfllmd.edgllhjec#ll#iif",
+"jkillllgc.jhl#cmcddddbfhjdjdh.ddddddihicbllhdc.limddddccdhacmhlliijlljddjlllllllccelli.cc.dddddckmheb#llljll#edhe#llm.e.#llllecn",
+"e.ebglll#mmeal#ehcdddilj.emijc..ddd.m#dj.llgdmchfaiabheddckcjhlliicii.mcd.lllllgmbjlgcnda.aaddddddjllllljblgmekegllicae#llll#imn",
+"mbdddeb#lfcadblgce.ddmlleklllgddddcl.#m.dlllei.ilcccmjhkhmdddkllijcdd#liddallllicdflhdddecg#cddddmlllllhefmdeedgllieac#l#lbagccn",
+"..ieddmccmmdacbl#eccddklgdmhbmddd..lja#mhjllf.c.g#.fhlll#jbcdblliidddjlgddhlllgegmll.ndmfmd.dddenllllljdiaecie#ll.jm.gbcccdddicn",
+"mjhkdclk.bmdd.cnl#ejcddnlhikmdi.dikbfebc.c#llejciidajllbjflcckllj.dhdd.ned.allb.enlndce#l#chacjlllllajcclbcaegllh.mcajddddccde.n",
+".jhl.dlcjllgcccdal#eiedcl#cllkigdcfdjmfi.cnllidd##ddflmbll#cdblljneebdagjddnllml.llckc#lllgmmglllfhc.lnd.j.c#lljdidddddddclgddcf",
+".ehlndadilllmddcdklgce.dflgmbnccd.kejbll.f.llgcbc.enlljlaeedjklljmd.mdhllmdblnmmal#c.cllllllllb.cdddjlkdemm#ll.ikdddddj#ncfijhmf",
+".ihlliddelllccdddcaf...millfecmddflfek##mmdflliej#llllj#dcaedblljhcm#cellnd.l.nillkhj.nillll#mi#jdddcmdcf.#llijecdddcdnlgi.nlecf",
+".eklll.dd#lgdbdncbdc##ejdallf.lbdgll.jed.damllgc.nllllmkdddddblljedd.ddillcegdcjl#cddcdfll##dflladdddchic#llmceddmagl.mecallljig",
+"ibhlll#.dblkdheagca.kl#ejchl#knljglgdglgid.ell#dijlllledd..cenlljkcel.cfmi.cdnj#lkeibnmb.iecm#l#..dddmee.#l.ehdmfllnmmaglllllccn",
+"m.hllllfde#bdddmnc.mmal#.c..i#bl.inidill#dmjbllhjellllkb.jaecalljcjkmcdl#ecf.mjllmcd.eddeddjhekmaaddekm#b.mhi.nl#hedi#lllllllm.n",
+"mkklllllndhkdjmdceh.jdbll.d.j#k#c#bddcbllcccclllckblllllllneimkamhceaadklgdeajnl#eacdhj.ldmelmblgddhgelll.hcjll#cddblllllllllceg",
+"..bllllllkccdmli.llfdacbl#mme.nndmheddamikacdflljeell#nbjmeddknbcdddccddhbcdhell.ec#meeeeilkme.mjdhmmllle.iilliekmkkllllllllljjn",
+".iblllllllbcdc##mg#mddkdall.idmjngned.n#.ilckillbemmmedmdkcddalleddmdcdmdedcbbl#dijfehlmmllfknclhekill#mjkml#hhachbelllllllllcef",
+"edklllllllgeddhlmddddddi.kll..malllkmlc#gdlhddnhccdcn..dcjafnlll#gnhjcdhegdddehjicgf#lbblll#mkcmenjlllebejllmkamflhjj.llllllljhf",
+".iklllllfjhcicd#ndddddddemkllm.bbllkil#iknlfcmeflndcin#nblllllllllllll#gajcdm#adbhllllllllllbjdhjjlllc.mj#n.ngjgllje.cfllllllccg",
+"e.hllllgeakllidagdddddcdcbdallmhckii.bif.ll#ddelllb#lllg.lllllllllllllllll#bglnddillllllllllncmcillg.cje.mj.li#nhkigadkllllllmig",
+".jillllfcblliddc#mdddjlmneacbll.#eiecddhagaddddglllllll#dllllllllllllllllllllladdecfllllllll.cihlllcjbmllllibd.a#bllgdallllllddg",
+".hilllllhjllcdddhg.#fhlljgcmihlljj.igkddccckdkgllllllllleglllllllllllllllllllll#h.ch.gllll#miaill#ci.dkbillhcd#fa#llkd.cilllljkf",
+".milllnjhmklcddd.l.gljbn..ccj.blljccaa.dccdj#llllllllllljn#gfnaanfg##llllllllllllfj.mdbllljjchllgeie.c#l.mfedcge.nkhejfej#llle.#",
+".ailllefjf.edddjm#g.lnddjggjmfcblljedhjdmccgllllllllll#bcddddddddddddehglllllllllllmdmemle.nbllledh.lfl#bfddde.ddb#jfllkjnll#hbg",
+"eehlllmjlkdddddddilnmehkbf.jjeichlle.ddchlg.lllllllnjcdddddddddddda#gajdejglllllll#efjcichmjll#ccjkahllfgnh##mddmhbjlllgcgll#ceg",
+"eddifl.cgndddbkaihlla.gijmalll..ma#eedcalllaklll#a.dddddddddddddddfllllcdddmalllllm#lljcdd.mlgeh.hjlmllilkflledddden##lacl#bedd#",
+"kddfcddjdddddkllillll#eelllllll.d.c#lh#lllllcglncdddddddddddddddddglll#dddddddalliallllbdklajckdaajfal#mlilladddddcj.ececjdihdd#",
+"lgcjc#e.ddddcckmgllllhmc#lllllll.jdillllllllf.mdddddddddddddddddddejm.cdddddddd.jhllllllgllfde.abacm.ccc.hllmccddd.lllhdc.kc.kgl",
+"##mnb.cadjddffhklllllijbmgllllllfdddglllllllbdddddddddddddddddddddfff#mddddddddddhllllllllgcci.gjncn#dddddjjk#bddddakm.jac..alll",
+"ee.nllfmdaefchgclllfl#djedkllllleddflllllllmddddddddddddddddddddddbgghddddddddddddelllllllbdd.#eccmlimdcjn.kmklkddddebfdmglbalgg",
+".ddcalllgbmmchcdeb#i.bm#ccehlllihckllllll#edddddddddddddddddddddddkkh.dddddddddddddefllllllbdh.diflhalj#lg.ige#kdjb...b#lllbe.dh",
+".ddjcebglllnmechccc.hhegc.lnllbcehllllllgcdddddddddddddddddddddddc#l#.ddddddddddddddegllllll.hddflfklbblljmbk.ceimi.allll#bmkddb",
+".mdjcfcd.glll#ad..hee#adddjlllcbdllllll#cddddddddddddddddddddddddddddddddddddddddddddd#llllllcadc.dnnd.fmkndcclcch#llllb.dhmhddb",
+".eeficdiceekllllnj.cmceddmhglmcckmfllll.ddddddddddddddddddddddddd.##bdddddddddddddddddcglllllicem##kn#gmdcjcacjn#lllgk.bei.iahjb",
+"...ll#hecebcehglllgi.chcccglfccilgmall.ddddddddddddddddddddddddddeabcdddddddddddddddddd.#llgmjinjblllfh...iejfllllgiemaj.hgllhjb",
+"ejmlllllgmccg.e.allllneccjdeeeellllijhdddddddddddddddddddddddddddcabdddddddddddddddddddd.lkc#llciilac.j#dealllllncjhge.#llllleea",
+".emlllllll#amcamkciflllgkmdmddnllllljddddddddddddddddddddddddddddhlkddddddddddddddddddddd.kllllnjmc.dhehgllllgj.chee.bhlllllljjn",
+".kmllllllllllfje.ke.jflllleecelllllleddddddddddddddddddddddddddddemdddddddddddddddddddddddglllllmdd.eb#llllnjcei.dmcflgjlllllecn",
+".djlllllllllllllgmdamdcil#d#lllllllkdddddddddddddddddddddddddddddbgdddddddddddddddddddddddjlllllndjjlllllidkjmddkclg.ecdilll#hkn",
+".hjlllllllllllllll#hdhcnemelllllll#ddddddddddddddddddddddddddddddnkddddddddddddddddddddddddalllllnlajla.chcjmakblfhfmkgicllllccn",
+".djllllllllllllllllfdem.jnd.glllllkddddddddddddddddddddddddddddddf.ddddddddddddddddddddddddclllllllndejch.icnljfb#jdd.llhbllljif",
+".djllllllllllllf#l.ddc#idddc#llll#cddddddddddddddddddddddddddddddjddddddddddddddddddddddddddflllllmde.ecallgc.jejeddfeallllllcdf",
+"mcjllllllllllg.dcedecdceccdjlllllhddddddddddddddddddddddddddddddddddddddddddddddddddddddddddjlllllmddkflllllg.dbibjd#billllllmhf",
+"mdjlllllllll#.dddea#cmkle.iallllledddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgllllg.h#ll#lllllkmbdbcb#hllllllmjf",
+".jjllllllll#eddkmllgillledd#lllllddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddklllllifbllhenllllllchcmlllllll#i.f",
+"mcillllllkcdddmbkllmb#gjdmclllllhecddddddddddddddddddddddddddddddddddddddddddddddddddddddddddmllllljmjlladdihj#l#dce#llllllllhmg",
+"ejjlllll#cddde#hcmeddccdc.hlllllenkijcdddddddddddddddddddddddddddddddddddddddddddddddddddddddclllllhbellm.deg#mllce.lllkgblg#c.n",
+".dmlllllcddecggcddhcccmdddnllll#dgfmllkdddddddddddddddddddddddddddddddddddddddddddddddddddddddnlniccc.nlgmed.lkhlji.llmccbmjljnh",
+".cmlllfic.klc.dm.hf.#h#dem#llllfd#lc#llm#nedddddddddddddddddddddddddddddddddddddddddddddddddddcjkf#ge.alljbmdbljbhi.#mdddem#leef",
+".ee##kdd###hddmieemdec.dcclllllbd#legll.llhhkeddddddddddddddddddddddddddddddddddddddddddddddddelllllchkl#nmn.mlbdnhiecmcie#l#bhf",
+"eddedededcdcdcdcddccdddddelllllkelljfllmllkhlhbkddddddddddddddddddddddddddddddddddddddddddddddclllllmkj#gfmjbegfdnihiigmgcfgadcg",
+"eddhcbdjdhekckdbeh.hcj.idelllllhde.c.ikeafii#haljiicddddddddddddddddddddddddddddddddddddddddddclllllhddkchckckchmb.ichckekchiddf",
+"gamjkhhihhhhihijijijiijdjhllllljddddddddddddcdc.c.k.ddddddddddddddddddddddddddddddddddddddddddclllllhcdhci.jcjcj.jejcickebcbjcdf",
+"llfnllllllllllllllllll#clllllllmdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddllllll#bj###########g###ggg#bdgn#",
+"ll#allllllllllllllllll#clllllll.dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddlllllllnhlllllllllllllllllllgelll",
+"fnkiffgg#g########ggg#ndgglllllmddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddclllll#nkmggg#g##############a.##l",
+"eddddecedddddddddddddddddclllllmddddddddddddddddddddddddddddddddddddddddddcimeedcddddddddddddddllllljdejdcdcdd.dcd.ddddddddc.ddg",
+".ddddiejdd.mjjcdjdjc.ddddelllllhdddddddddddddddddddddddddddddddddddddddddddmb#le#feghefejhecmedlllllidefekcimjamacbcackeijjkfdcl",
+".dcacdeccj.jcmdbhebkbkkmjmlllllbdddddddddddddddddddddddddddddddddddddddddddddcjelgmlbiljllhnlncllllliiddhddcccdddeijdde....m.ccl",
+"mdcfdddcd#aijacg#ciba#l#eelllllkddddddddddddddddddddddddddddddddddddddddddddddddceelbhlmll.llkelllllecdcem.imjdhbfljhllllllllbjl",
+".ddicddcflg.jk#hl.dddhllcdnfbijmdddddddddddddddddddddddddddddddddddddddddddddddddddm.ilmll.llj.llllleadfmmedddklngiclllllllll..l",
+".ddch..flllc.iljffdddblleddehfl#ddddddddddddddddddddddddddddddddddddddddddddddddddddddicnl.ll.hllllgdmdccddmfj#ljjdjllllllll#bil",
+"ehc#nlnllllcc.lgeggcdnll.emlllllcdddddddddddddddddddddddddddddddddddddddddddddddddddddddd.c#lcfllllfj.dh#a.llm#kdddnlllllllllccl",
+"ed.llllllll.dellgkh.dalljmclllllhddddddddddddddddddddddddddddddddddddddddddddddddddddddddddc..lllllkecbllbflncacmhallllllllllhjl",
+"ecellllllj#mdelbglllbjllb.d#llllgddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddillllljbc#lk.lidddelllllllllllllccl",
+".d.llll#fkcc.jcmdmlllllll.hallllledddddddddddddddddddddddddddddddddddddddddddddddddddddddddddnlllllemdkcdceddddalllllllllllllh.l",
+"ed.llla#cgjd.akeddjlllllkcdmllllliddddddddddddddddddddddddddcdddddddddddddddddddddddddddddddd#llllkcjddddddcjd.#lllllllllllll..l",
+"ec.lllmhkebdemc.nacnl#kck.de#llllfddddddddddddddddddddddddddkcddddddddddddddddddddddddddddddhlllll.ddddcdde#lgllllllllllllll#mel",
+"edcllladn.dkfgfinlae.dmcceilllllllidddddddddddddddddddddddddnddddddddddddddddddddddddddddddcllllllg.cdnedmlllllllllllllllllllccl",
+"edelll#edchlbkljla.ddd.bgg.lglllllgddddddddddddddddddddddddmnddddddddddddddddddddddddddddddilllllllbih.cic.hfllllllllllllllllkjl",
+"edmllllkjlhb#eeceddc.alll#djcalllll.dddddddddddddddddddddddakdddddddddddddddddddddddddddddc#lllllk#j#llaeem.dmglllllllllllllli.l",
+".c.llllgelhdddddcdklllllne.cdcllllllcddddddddddddddddddddddjhdddddddddddddddddddddddddddddklllllbdde#llll#kcc.ccilllllllllll#jel",
+".d.lllllgmcdidd.b#lllfhecjeeddfllln.mdddddddddddddddddddddmlhddddddddddddddddddddddddddddcilllll.ddj.mnllll#ajc.chjnllllllll#jel",
+"eemllllgmcbd..nllllgjc.cd.b#enjllk.flmddddddddddddddddddddmicddddddddddddddddddddddddddddnh.#llbdd.iijcea#llllamch.j.a#lllllleel",
+"edellaed.jcklllllacdbeddcgllndejcalll#ddddddddddddddddddddbljdddddddddddddddddddddddddddjllgdklcaellkccf..m#lllllb.c.hd.flll#k.l",
+"eddh..ce.b#lllgh.jim.dj#nehm.dkcnlllllfcdddddddddddddddddilljddddddddddddddddddddddddddjllllg.cjenl#l#.de.jcmalllllnmcjc..kg#..l",
+"edd.ei.fllllfjchcmca#illjfgmcddkjllllllkdddddddddddddddddbnhcdddddddddddddddddddddddddc#llllladkilln.#kdddccmdck#llll#kckdjc.jjl",
+"edddkllll#icc.edj#h#c#lnafmlnddddalllllladdddddddddddddddhfl.ddddddddddddddddddddddddcllllllleac#lllhdddmaddde.ec.nlllllnmdmgdcl",
+"m.he#llnic..ecb.g#jiekickilncd.cdmfllllllkddddddddddddddillledddddddddddddddddddddddegllllll.j.fll###d.kmnenmddeea.mb#llllgjcdcl",
+"llle#a.cicmdd.fnlgdieddddkleddgncje#llllllacddddddddddddhkhhddddddddddddddddddddddd.gllllllbdkmlllnccdhl.cnllbdkcjegcch#lllfca.#",
+"llgddkc.dddddcmllcflcmddddcdibblbddclllllllleddddddddddca#lgcdddddddddddddddddddddillllllladcelllll#jdejjnlllli..#cccidceklf.lll",
+"fidkc.jaadddddd#kjlfhi#ambddeflamhc#llllllllgedddddddddjl###ddddddddddddddddddddeallllllll#id.illllllbife#llllndblmddddh.m.jclll",
+"eddddenheddddddfe.lhljllhl.jagae..ib#mllllllcgfcdddddddcm...dddddddddddddddddddeallllllllllfckcallllllaccblll#c.hbiddddeehk.cjfl",
+"edeaek#leneddddddddhljl#albajaeee#ledddglllahlllaedddd.llllbdddddddddddddddddjglcflllllkc#bmljm.hllllll.jlllfcallcddcdcjmjecbddn",
+"edmb.iajif.ddddddm.llj#kfl#b.db.llgcdde.alg.llllllnmddmglllkddddddddddddddciflll#.gllliddcjlllicjhlgihebhhllgcllledddakehllnjddn",
+"ed.bdmdjkemaddddcljlljgelllc.ne#l#e.dhmcck.nllllllllgjcc.kn.dddddddddddceklllllllkcl#mcdd..glll.iciellilfeflleaibcdddkl.llllleea",
+"ehmlllmhlmllcddd.lgehhiblliimelllecdfllm.ddfllllllllllllfkmeedddddeemj#llllllllllliecckk#.kd#lllijedjmccnlmllgdddddd.#hhilll#men",
+"ecjlllmij.hhcedd.ll#kmcglkjjjll#ejmnllllbc..jflllllllllllll#l#####lllhllllllllllla.ejdd.bnebeflllj.cdcffbl#illedddenmhahklll#ejn",
+"ejmlllhjdi#cf#dddjllliciim#mll#.bcnllllll#.ic.i#llllllllllllllllllllljlllllllll#m.eheedjbbneee#lllemjeblmgleglgcddblhj.nlllll.kn",
+"edjll#j.djjllgcajdi.emhdki.lll.hdnlllllllllgecdd#lllllllllllllllllllliflllllllmcdaehaadenllfckc#lllmcmegbeidmlladc#llmgllllll..n",
+"ehklllanchmln.nlbdkgnn.cjjll#.ejbbllllllflllleckliehfllllllllllllllllbklllfallkddi#fjlcbfnkjkcaenll#miecdddddbll.cflkk.lllll#hjn",
+"c.hllllfcink..llkal#ddmk.lll.h.jbilllllkelllabeejdddd.in#llllllllllllnenj.dc#lieail.ik#hdhnl#.cecglllcbcddddd.llndc.nhjlllll#ddf",
+"ejmllll#cdcafiljklllemk.lll.adicfhallljclacnccjlh.ddmea.ic..jhllf.mececfjkddcmfbjinilnkgd.m.kggjjc#lllmkedddddfllcddcnllllll#khn",
+"ejjllll#.ejlhehmll#jk.jll#.c.abeahillkjcmdbncmfl.icccecchcn.dcllfddicheiibhkcllgmjienlhdd.h#lllb.kegll#mmidjnf.lljdde#llllll#eef",
+"emjllllifjgkmgj#llmc.mlllma.dhjfdbmfahnkadjdjml#.egm.#.dcdmccciijddjknlllllejnllcheeemjddkgmglll.ch.#ll#ej.#llcnlnddd.#lllll#hjf",
+"ef.lllbhnccnim#lbechmllleacddblle#fedjklndddealmjemdc#gcljmhjcf#bgj#lllllllia.llajcclllmdklljm#jb.eecllll.heabb.ll.dedd#llll#edf",
+"ccilll.amaemnghedjmjll#...dddmnhcbnddmjmjfdid##djdd.cnlei.fc..llfccgaabbbklgcefll.ndiglfd.b#lnchlmbij.#llfcf.cjc.#mcadd.#lllgjif",
+"emjllbeeflkdcdddkcmlll.cjdddddh#lcmckllinlc..lndmcdg#egen.heamllnhjgbhmddmllikhllijdaeb#d#beflmg#mljcn.lll.che#ijmem#cddhlllgeef",
+"edjliblgdmcddeejeee#lejmbedddegjmglllllgkcik#l.jjfdclledi.mdcellndcfmece.lllg.mllgelej#.clllncikai#aacjc#mageccmil.nl.dddfllfkj#",
+"c..mdilhddddddejjlaeehdklfdddehfllllllllgd..lnddalhdhlhcg.ajb.llnamikhcghlllne.klljmd.hjkigllenfbbmllem.eillncjdc#.lljddkcllgjeg",
+"c.dddd.dddccdikjlll.cmmkl#d.blll#hhlllllkdhiljjd#lfdcafd.keccellfcdndmflilli.km.llfc.ai.lg.imddddddalidea.lllgdbdebllide#dblfmef",
+"ccdddddddf#cncjll#cmmbjfij#lllg.cbnc#lll.ec#l..hl#cdde.d.kccfmllfbi.#lkmg#ccll.c#lldccfaindddddddddelledcam#llgci.nllhdb#cdggimg",
+"ccdddeanfgmimill#eddjae.klll#hcdmglijfiediilnem#llmddalnciid.ellg.e#niblliecihmkmllhhmgfmgcdddddngacilkdd...gllne.eilic##cdhfccg",
+"cccanlllle.billl.bcehfhblllkcddddclncehbedfleeellllmcd#ladcdnmllgjjhmllllghe#gcdcgllcem#dbeddddmillfclnd.hea.lllfcgc.chl#dd.fbig",
+"ecillll#cajkll#eemm#lhalnjcdccdddcgbgllmddlgdmklllll#.mll.ddccllfcce..mm..ha.lbcjklliadkddddddjlg.llgnfddbacne#llfe.dejiidddcddg",
+"eeilllg.bchllg.j.ceihcmcdddcjbddddddb#he.ilk.clllllllideb.dda.llgjkjbj..ihkihljcej#lncmdddddddcnlnnllmkdddkhj..fllfmcmafbicddjjf",
+"cmjlllec.kll#efedgbcdddcdddklke.edcddcd.j#lekhlllllllkddjamdeellgcebakkcc.kjcjfac.kll.gcdddddhjc.bcglidiedclheee#llfcbd#llfmd.eg",
+"cdjlfcijbll#cbdbhlll#nbmdcmi#labl.ddddcimlbddflllllllleddglcf.llf.ih###lll#ec.l.dkmllndmdcddmlliagicmhklkdd#lbenc#llncncflllahe#",
+"c.cf.gckllgemenhfllllnic.giaklfm#ncjcdcmal.delllllllll#kchl..ellfccjkllllljjadmfbeegl#cmdddd.il#illkmeiljddeflhmm.glla.emfllnic#",
+"cdccmmbll#e.calm##gheddelllimnecccnlkdhellcdblllllllllllbelenellgcjhcblllaindeiljehjllijbcagljllmglfdnmlcdddjllh.me#llnc.d#lnm.#",
+"cccmibll#eedfl#ecdddddillllgkhcjl.j#fdcblidclllllllllllladfeeellfdckddjlllkefkdegncdfllemmlllmlljmbjcgiej#mdd#llbefc#llaehcfnj.#",
+"cdddkllf.eeallkgnjcdcalllllllljheccecm.f#demllllllllllll#c.daellgem.cddal#hgkckgllm#jlljjdglljik.mhi.lgd#lgdd#lllicemgllacaejjc#",
+"ecd.llgc.mnllldfgaee#llllllllllhgmcicc.lfdealllllllllllllhddcellgddacdclllljklllllfcclladcillb.hhmlllllmllfddnllllijbellla..ma.#",
+"edbk.fcicgllladdddallllllllllllllln.mknljm.lllllllllllllllidfellgce.dd.mllllllllllldbjlle#..ahel#llllll#mgcddcllllladnc#lln.bdd#",
+"ehllicbenlll#edd.glllllllllllllllll.dclfdcblllllllllllllll#d.ellfddngh.#llllllllllljce#lb..ebhklllllllllbceddd#lllllimcjglb.cdc#",
+"lllgelcbllll.ddallllllllllllllllllgdcd.ccdglllllllllllllll#dkdc.c.jfllg#lllllllllll#.md..dnclllllllllllllhancdglllllliefebe#fdcl",
+"ll#cdcccccecddeecccccce.cccecec.eecddflcddccccccccccecec.ecddcllfddcccecccccec.cjc.ccdd##jddccccccccecccccdecdceje.cecdcddfllkd#",
+"lghdddhcdd.edd.cddddddehdcd.dcd.ccddjlndddc..mddjm.e.cjcmc.ddell#cccccmceccdjdmcicmccddnlgcdd.ddddddddjdcdjdidhefcbckdddddcfllal",
+"lbanfffnnnanabhbafnnaanaafbnnnaaaaanglgjhhbbbibbbajbbkbkhkhjjhlllllllllll##g#g##gg#fgfnlllfnnnanabbbbbbabkjbaaanbabnbabbbhknllll",
+"llllllllllkim..mjijmhkkhjj.ijmim....himbhaa...ibkbnaabbbaaakfffgfnnang##nbbbanlffl#ggabbnafnbbbabbbkhhimmmhijimbkecc.flgmec.klll",
+"llfjcd.hlnddddddddddddddddddddddddddddddilcddddddddddddddddddddddddddddd.dddddjdd.dddddddcddcddddddddddddddddddddecddagcdddddj#l",
+"lnddddddcgdddddddddddddddddddddeeddddddnhfcddddddddddddddddddddddddddddddddddddddddddddddbhckddddddddddddjncekddalnddbddddddddml",
+"lcdddddddedddjf.dddddhbddddddd...ddddcbcdlcdddddddddddeddddfadddd.kddddd.dddddddddddddddddbhkdd.cddcjahd.gmddcdnfm#cdddddddddddf",
+"kddddddddddddjcddddcid.ecdcdddddd.jdddddd#ceedddhedddjgcddkiacdijebdmmddhdjkhiddddddehdddde#add.khajlmddmc.nddigcdg.dddddddddddk",
+".dddddddddddddddddddddddde.dddddd#iddddddkdddddd.#nhb#eddbmdecddd.imlcddjcacdcddddjddddddddmaddddemdfcdddengcjl.ddajdddddddddddk",
+"mddddddddddddddddddddddd.jdddddmn.ddddddddddddddddcaeddc#.dddddddihmf.ddnhddddddddkbcdcdddm.nddd.gddmdddchcfdkhdddh.ddddddddddd#",
+"jddddddddcddddddddddddddedddddmgdecddedddddc.dddddcidddi.ddddddddccdmeddidddddddddcnfnjdddecnddd.edddc.dddcndhcddd.ddmddddddddml",
+"gcdddddddbccdddddddddddddddddddddddddhdddddc#cdddd.mdddddddddddddddddddddddddddddddddddddddcfddddddddjaddddjdddddddddfjddddddd#l",
+"laddddddhleddddddddkidddddddcmdddddddmddddddddddddj.dddddddddddddddddddddddddddddddddddddddcfdddddddddddddddddddddddd#lacddde#ll",
+"gacdddddibcdddc.jb#ln..e.mmialannabhmmddddddddddm.aim....mjmmeedd.mee.e.e.eeeeedddddddddddce.eeeeeeeee..ee.ee....eeedmjjedddc.ml",
+"eddddddddd.###lllllllllllllllllllllllbddddddddddflllllllllllllldcllllllllllllll.ddddddddd.lllllllllllllllllllllllllliddddddddddn",
+".ddddddddd.lllllllllllllllllllllllllljdddddddddd#llllllllllll#cddcnllllllllllll.dddden#g.bllllllllllllllllllllllllllidddcingfddh",
+".ddddd.dddmllllllllllllllllllllllllll.dddddddddd#lllllllllllgeddddcflllllllllllndddddebddhllllllllllllllllllllllllllidddmaabkdcg",
+".didddidddmlllllllllllllllllllllllllgdddjddddddelllllllllllleddddddcllllllllllll.ddddcnddmlllllllllllllllllllllllllljdddddddddel",
+"hdddddjedd.lllllllllllllllllllllllllgdddecddddd.llllllllllfeddddddddcflllllllllhddcdddk.dellllllllllllllllllllllllll#iddjednadel",
+"fcddcdddddmlllllllllllllllllllllllllfddddddddddhlllllllllfcddddddddddcnllllllllf.dedddchddlllllllllllllllllllllllllllhdcghdbfdel",
+"jddmjdddddmlllllllllllllllllllllllllkddjmddddddallllllllleddddddddddddcllllllllllcddddddddfllllllllllllllllllllllllllcdaiddjfdcl",
+"mddnmdddddilllllllllllllllllllllllllmdddddddddclllllllll.ddddddddddddddcgllllllgeddjidddddblllllllllllllllllllllllllgddjdddeadcl",
+"mddnidddddilllllllllllllllllllllllllcdddddddddcllllllllfddddddddddddddddbllllll#ddd.iddmambllllllllllllllllllllllllllcddc.dcmdel",
+".dddddd.ddillllllllllllllllllllllllbdddddcmddd.lllllll..ndddddddddddddddflllllllddddjddchddnllllllllllllllllllllllllledde#ddddel",
+"mddddddmddilllllllllllllllllllllll#cddddddccddhllllll.ddeeddddddddddbl##l#.#llll.d.n#iddjdd.llllllllllllllllllllllllledfmdddddel",
+".ddcddddddilllllllllllllllllllllllbdd.edddceddnlllllbddddddddddddddckcdcmcdj#llladek.cddccdd#llllllllllllllllllllllllmd.ckcdddel",
+"eddfadddddilllllllllllllllllllllllmddhdddddddclllllbddddddddddddddddddddddddellll.dfddddddddmlllllllllllllllllllllllllhdddddddel",
+".ddc#jddddillllllllllllllllllllllnddc#gkddddbfllll#cddddddddddddddddddddddddde#llhdedddddddddallllllllllllllllllllllllfddddddd.l",
+"mdddhacdddilllllllllllllllllllllledddicdddddjllllnghcddddddddddddddddddddddddd.#lfdddiedddddd.lllllllllllllllllllllllleddddcdd.l",
+".ddd.lheddilllllllllllllllllllllifcdddddddddd#llkddgnddddddddddddddddddddddddddelljdddddd.ddddmllllllllllllllllllllllkddddmndbll",
+"iddddmheddjllllllllllllllllllll.ccdddddde.ddnllkdddcaedddddddddddddddddddddddddd.#gddddedhhddddnlllllllllllllllllllllmdddikdddel",
+"#idddddddd.lllllllllllllllllllmddddddddddddmlladddddcnjddddddddddddcakddddddddddd.g.dddaceacdddcglllllllllllllllllllleddd.ddddcl",
+"lnddddddddmlllllllllllllllllljdddejedddddddglkddddddddb#iaddddddddelllbdddddddddddcliadcddddddddc#lllllllllllllllllll.dcddddddd#",
+"mdddddddddjllllllllllllllllljdddahecddddddk#nbdddddddddbfcddddddddnlaklfeddddddddddekdddddddkadddcglllllllllllllllllljdckmddddd#",
+"jcddddddddillllllllllllllllkddh.fedddddddcf.dcdddddddde#edddddddddca.dhg#hcddddddddddddddkjdddddddcflllllllllllllllllkddcn.ecddg",
+"l#hdddkkddjllllllllllllll#.ddddifeddcddddiedddddddddddhfddddddddddddddddcimdddddddddddddc#cddddddddhi#llllllllllllll#cdddd#l#cdg",
+"geddddcgcdjlllllllllllllaedcddddcdddddddddddddddddddddb.dddddddddddddddddddddddddddddddddcdcakfhddddddj#llllllllllll#cddidcccmdn",
+"mddcdddkjdjlllllllllllamdddmhcddddddddddddddddddddddddkdddddddddddddddddddddddddddddddddddddcdeedddddddcb#llllllllllgddddddd.hda",
+"eddfeddddd.lllllllllbcddddddddcdddddddddddddddddddddddcdddddddddddddddddddddddddddddddddddddcdddddddddddddjllllllllladddddckfddk",
+".ddikddddd.lllllfbnadddddddeahcdeffidddddddddddjidddddddddddddddddddddddd.#iddddddddddddddddcdddddncdddddddc.k#lllllbddddmm.dddf",
+"mdddfcddddchbimcdd.cddddjdddcgfdd.cddddddddddchljddddddddddddddddddddddddebcddcddddddddddddddj.dddjiddccdddddddcmjih.ddddddddddg",
+"mdddj#dddddddddddddddddddddddccddddddddddddddaliddddddddddddddddddddddddddddddfeddddddddddddde#dddmbdclhdddddddddndddddekkmddddg",
+"bdddd.ddddddddddddcdddddagaedddddddddddddddddal.dddddddddddddddecddddddddddekljdddddddddddddddcddddaidcdddddddcecaddddcghm.ddddg",
+"ndddcdddddddddddddbcd.ddea.dddddddddddddd.g.dd.ddddddddddddddddk.ddd.k.ce.alljdddddddddddddddddddddcaaedddddckhbfmddddcmdddcmdd#",
+"kddbfdddddddddddd.id.lbdddicddddddddddddcln#.ddddddddddddddddddajdddjlllllllkddddddddddddddddddddddddhidihddkdddieddddddcddkndd#",
+"kdcmdddddddddiddd.bdegfnddddddjkddddddddhedhlfhcdddddddddddddddnkdddellllllidddddddddc#beddddddddddddkmd..ddcdddfcdddddcdddbcdcl",
+"kdcdddddddddcfd.ibbdddilidddca#cddddddckedddmafggfaieddddddddddfbdddellll#jddddddddddmgagnhmdddd.bccckddddmddchdhcdehddcdddaddd#",
+"kdfe.bddddddc#flfcdddelbcddnlleddddddcl.dddddddddddddddddddddddfndddclllgeddddddddddc#.ddccddddddclfhcddddamdk#cddml.dddddcidddf",
+"kdcjmehedddddja.cdddddcchfll#eddddddhg.ddddddddddddddddddddddddffdddd#n.ddddddddddddnadddddddddddd.#la.cddccddf.dbhcdddddd.fedd#",
+"bdcdddciddddddddddddejnllllljddddddb#geddddddddddddddddddddddddgfddddcdddddddddddddabddddddddddddddblll#nk.cdddddbhhmddddddhbdcl",
+"bdhjdddhddddddddddhgllllllleddddddddddccddddddcddddddddddddddddlgdddddddddddddddddbli.ddddddddddddnlllllllllniddddddddddddddeddl",
+"kddgedmmddeafg##llllllllll.dddddddddddddddddddcgiddddddddddddddl#ddddddddddenddddcjikicddddddddmcdeieeglllllll#gfabjmdddaeddjccl",
+"kddkkdi.dd.lllllllllllllljddddddddddddddddddddde#neddddddddddcjl#ecddddddd.ghdddcddddddddddddcklkddddd.llllllllllllllcddifijfdcl",
+"kdddddddddmlllllllllllll.dddddddddddccccddddddddellbdddddddeflllllllhddddilnddd.lmddddddddddhl#jddddddddlllllllllllllcddddd.ddd#",
+"hddddddddd.lllllllllllljddddddcibfg#llllllgfhcddd.llg.dddmnllllllllll#kdbllmdddkbcdddddddddcmedddddddddd.#llllllllll#cddddddddcl",
+"hddddddddd.llllllllllliddddddjfgg###llllllll#cddddm#lljdjllllllllllllllglladdddddddddddddddddddddddddddddjlllllllllllcdddddddk#l",
+"hdddddddddmlllllllllljddddddddddddddcjh#llllcddddddc#ll#lllllllllllllllll#ddddddddddddddddddddddddddddddddmllllllllll.ddddddddjl",
+"idddej..ddmlllllllllidddddddddddddddddddcjfadddddddd.llllllllllllllllllllliikaahcdddddddddddddddmfeddddddddmllllllllljddddddddd#",
+"mdddddcacd.lllllllladdddddddd.mcdddddddddddcdddddddddklllllllllllllllllllll#nj.ccddddddddddddddd#lfdddddddddmllllllllndjcdddddda",
+".ddddcc.fd.lllllllkdddddddddanedddddddddddddccddddddclllllllllllllllllllllljdddddddddddddddddddcllleddddddddallllllllkdddddddddb",
+".dhedmedmd.lllllll.cdddddddhjdddddddddddddiflledddddhlllllllllllllllllllllladdddddddddddddddddddinacdddddddemdenlllllkdddddddddf",
+"mdgmdddm.d.lllllgbaahme.mjaidddddddddddd.g#fnicdddddfllllllllllllllllllllllleddddddddddddddddddddddddddddddddddc#llllk.mmeeecdda",
+".dkkddemdd.lllladddddddddceddddddddddddckedddddddddellllllllllllllllllllllllhddddddddddddddddddddddddddddddddddddllllfkh#ln#fddi",
+"mdc#dddddd.lllncdddddddddddddddddddddddddddddddddddmllllllllllllllllllllllllfddddddddddddddddddddddddddddddddddddcnlljdd.cdkcddm",
+"mddfmdddddellfddddddddddddddddddddddddddddddcee.jik#lllllllllllllllllllllllllaanakj.eccdddddddddddddddddddddddddddcnlmdddddhdddm",
+"bddd.dddddclnddddddddddddddddddddddddddddckgllllllllllllllllllllllllllllllllllllllllllliddddd.dddkcdddddddddddddddddfeddddd.dddi",
+"bddddddddddbcdddddddddddddddddddddddddddd.ihknf#llllllllllllllllllllllllllllll#naij.ecdddddddhddd#cdddegicdddddddddddddddddddddi",
+"bddddddddddddddddddddddddddddddddddddddddddddddddejallllllllllllllllllllllll#cddcdddddddddddcgdddlcdddd.l#adddddddddccdddddddddm",
+"kddddddddddddddddddddddddddddddddddddddddddddddddddcllllllllllllllllllllllllgddddddddddddddd.lcdd#adddddjlhddddddddc#cdddddddddj",
+"bddejddm.de#eddddddddd.dddddddddddddddddddddddddddddfllllllllllllllllllllllladddddddddddddddi#dddkljdddcghddddddddeglcddddkedddn",
+"bddfiddcddelg.dddddddhl.dddddckddddddddddddddddddddeglllllllllllllllllllllll.dddddddebeddddd#fdddckeddeghddddddddcfllcceeejbdddf",
+"bd.mddddddelllmddddddjgl.dddhll.ddddddddddddddhddcffj#lllllllllllllllllllllnddddddddhleddddclbdddddddh#mdddddddddllllcelabbhddel",
+"adkedddddd.lllljddddddci#gflfimcddddddddddddddaaahedd.lllllllllllllllllllllhdddddddddeddddi#lkcce.ibfjcddddddddefllll.djmdddddcl",
+"ndfceabddd.llllljdddddddjllhdddddddddddddddcce#hcdddddnlllllllllllllllllllgcddddddeddddddddcag#gggniddddddddddcfllllljddicdddem#",
+"fdblncnddd.llllllhdddddddigdddddddddddddddddklfddddddbllllllllllllllllllllhddddddjlcdddddddddddddddddddddddddc#llllllmdddedddbll",
+"nmf.ddfcdd.llllllliddddddcedddddjnfbkjcddddddnjdddddillllllllllllllllllllllbdddddhmdmkddddddddddddddddddddddcflllllllmddddddddeg",
+"lnddddm.dd.llllllllhddddddddddddjlllll#mdddd.addddd.llladalllllllllllllgallladdddcdiiddceecddddddddddddddddcnlllllllljdddddddddg",
+"adddbddddd.lllllllllndddddddddddd#llllledddclcddddc#lgcdddhllllllllllaedd.lllhddddcddddiallgedddddddddddddd#llllllllljdcne##jddf",
+"addmfddddd.llllllllllacddddddddddallllmddddk.ddddcglkdddddddjalllla.cdddddeallhdddddddddddmklhdddddddddddcnllllllllllmdchdecdddg",
+"addddddddd.lllllllllllgcdddddddddjlllfdddddedddddbljdddddddddddgll.dddddddddjllmddddddddcjbkjddddddddckccflllllllllllmddmddddddf",
+"bdddddddddmlllllllllllllccjdddddddfllmddddddddddaadddddddddddddnlledddddddddddaldddddjje#.ddddddddddddnllllllllllllllmdce.cdddc#",
+"addbaci.dddmjjhaglllllll#fedddddddhlndddddddddddjddddddddddddddbllcddddddddddddmhddddd.iahcddddmdddddd.llllllllg#llll.ddd.cdddd#",
+"bddfl#aadddddddddmfbgllllfcdddddddeljddddddddddddddddddddddddddhl#dddddddddddddddddddddddjfidddidddddcfllll#nicdclll#cddddddddd#",
+"kddaniiiddddddddddcddd.all#cdddddddl.ddddddddddddccddddddddddddmlndddddddddddddddddddddddddm#.ddddddclllla.dddddddmcdddddddddibl",
+"bddddddddd.niddddddf#fkecjnacddddddhcdddddddddddnfcddddddddddddelhddddcaedddddddddddddddddddea.ddddcfllbedddddk.dddddddddddddfll",
+"hdddddddccmlidddddcnfnnhdddjhddddddddddddddddddde.dddddddddddddd#eddddcf.dcjeddddddddddddddddddddddn#kcdddddddecddc.eddddddedjll",
+".dddddddnhcjd.dddddddddddddddmcdddddddddddddddddddddddddddddddddfddddddddddc#jddddddddddddddddddddnjdddddddddddddd.aaddceddgdd#l",
+"iddddddddddebbdddddck.ddddddd.cdddddddddddddddddddddddddddddddddkdddddddcdddelf.dddddddddddddddddcmddddddddccdddddddddddhnnljdfl",
+"idddiddddd.lkdcdddddflacdddddddddddd.keddddddddddddddmdddebmddddcddddddd.fkfgjeddddddddddddddddddddddccddddd.dddddddddddddcghdfl",
+".dddbhddddddddmcddddddcedddeddddddddhllfcddddddddddddhidddmlhdddddddddcddjlmddddddddddddddmdddddddddd#.ddddcgeejdacddddddddfddll",
+"fijkn#dddddddddd.fdddddddddjcddddddd.lfhcddcmbh.ddddddgedddhleddddddddmfa#.ddddddddddddddnnddddddddddebbdddded.km.dddddddddddill",
+"fiihhidddddddcdddddddddddcigdddddddddjddddddddh#amccddakdddd#hddddddddddkaddddddddddddddclfdddddddddcihhdddddd.ecddde#eddddddall",
+"hdddddddddcgn#nhcddddddddcn.ddddddddddddddddddddc.gl#fggddddakdddddddddddddddddddddddddddflmddddddddcfmddddddddeaccegkddddceddc#",
+"iddddddddd.llllll#njdddddddbmddddddddddddddddddddddemkakdddd..dddddddddddddddddddddddddddck#hcddddddcjfcdddddeiallllfddddmihdedk",
+"idaeddddddjlllllllllg.dddddd.dddddddddddddddcmmcddddddddddddddddddddddddddddddddddddddddddddccdddddddcddddcjflllllllnddcakdddiek",
+"jdhcdddddmllllllllllllgmdddddddddde#edddddddaflledddddddddddddddddddddddddddddddddddddddddddddddddddddddcfllllllllllgdcljdeddbmb",
+"iddddddddnllllllllllllllb.dddddddddjgdddddddddckidddddddddddddddddddddddddddddddieddddddddddijijddddddch#lllllllllll#ddbndicda.b",
+"hdddcidddcnlllllllllllllllidddddddddadddddddddddddddddddddddddddddddddddddddcdddddddddddddddiddcddddd.glllllllllllll#cddg.e.da.b",
+"idddn.ddddelllllllllllllllladddfnaf#.dddddddddddddddddddddddddddddddddddddnlleddddddddddddddddddddddalllllllllllllll#cddhbdddnek",
+"kdcffddddd.llllllllllllllllln.cm.ijcddddddkidddddddccddd.kdddddebhcdddddcbhmcddddddddddddddddddddd.glllllllllllllllllcddmfdddaca",
+"hdal.ddced.lllllllllllllllllllcddddddddddd.l.dddddjaeddelkdddddnllidddddddddddecddddddddeeeddddddelllllllllllllllllllcddcbddekcb",
+"hddcdddddd.lllllllllllllllllllgcdddddddddddaliddcnaddddnlhdddddkllmdddddddddddkcddddddchedddddddklllllllllllllllllll#cddd.ddcldf",
+"iddddddddd.llllllllllllllllllllbdddddddemddjllkdnfcddddblbddddddmmddddddddddddhmddmddekicdddddcalllllllllllllllllllllcdddddddjd#",
+"bdddd.c.ddilllllllllllllllllllllcdddddcbgddclll#l.ddddddk#cddddddddddddddddddd.ndigdd.gl#cdddelllllllllllllllllllllllcdddddddddg",
+"g.dd.fdhdd.lllllllllllllllllllllfdddmkaddjednllladdddddddcdddddddddddddddddddddillmddddcgkdddc#lllllllllllllllllllllledddddddddf",
+"liddhnh#miallllllllllllllllllllll.ddi#hdck.dcllllkdddddddddddddddddddddddddddddallhddddd.bdddellllllllllllllllllllllledddddciddg",
+"gdddhjmecekllllllllllllllllllllllndddjlhddddilllllkdddddddddddddddddddddddddddkllgmdddddmidddhllllllllllllllllllllllleddddcddddf",
+"ldddidddddcllllllllllllllllllllllljdkhdfbddddilllllfddddddddddddddddddddddddcgllleddddddcddde#lllllllllllllllllllllllcddddcbcddf",
+"lcdd.dddddcllllllllllllllllllllllladcgn..ddddcllllllndddddd.ddddddddddddddddblllgddddddddddc#llllllllllllllllllllllllcdchfdeacdf",
+"ldddddddcdclllllllllllllllllllllllgdd.#hddddddnllllllfcdddd#eddddddddddddddblllladddddddddd.llllllllllllllllllllllll#ccgidcddddn",
+"gddddddddddllllllllllllllllllllllll.ddddddddddjlllllll#edde#dddddddddddddcfllllljddddddddjhgllllllllllllllllllllllllgddbeddddddn",
+"#ddddmcdddcllllllllllllllllllllllllfddcia.dddd.llllllll#ccnmddddddddddddcallllllcddddddddcnlllllllllllllllllllllllllfdddidddddda",
+"gdddddddddclllllllllllllllllllllllllcdelmddeddclllllllllgffdddddddddddddalllllllddddddddddmlllllllllllllllllllllllllnddddddddddb",
+"lcdddeihddcllllllllllllllllllllllllleddfdddddddglllllllllfcdddddddddeddnlllllllgddddddddddalllllllllllllllllllllllllnddddddcddda",
+"ledkkhceddclllllllllllllllllllllllll.ddgcedddddhlllllllllladddddddddifbllllllllgddddcdddddflllllllllllllllllllllllllnddddddacddn",
+"#mdcddddddcllllllllllllllllllllllllljddfjgc.dddhllllllllllladdddddddd#lllllllllfcecnfedddd#lllllllllllllllllllllllllnddddddimddf",
+"nddejddddddlllllllllllllllllllllllllhddk#hdfdddhllllllllllllnddddddc#llllllllllk.jdddddddcllllllllllllllllllllllllllfdddddddddda",
+"ndddddddddcllllllllllllllllllllllllladdddddcdddjllllllllllllladdddcalllllllllll.mhdddddddmlllllllllllllllllllllllllladdddddddddb",
+"ndddddddddclllll######llllllllllllllbddddddddddcllllllllllllllbdddallllllllllllc.bdddddddilllllllllllllllllllllllllliddddddddddg",
+"gji.dddddecdcccddddddddddaf.cdccdceecdddddddddcdcecc.fembhjllkheddhkan#l#g#g##gd.addddddde#ll#glgggfbbbkhkiikkhkkhijcddddddddddf",
+"ll#jdddddafdddddddddddcddcdddddddddddddddddddd.ddddddddddddimdddddddddifcdddddddddddddddddccdddddddddddddddddddddddddmiddddd.g#l",
+"lledddddddidddcdddddddddddddenjmddddddddddddddmdddddddddddddddddddddddddddicddddddddddddddddddddddddddcddcdddddddddddacddddddhll",
+"lhdddddddddddddddddddddddddmhcdcfdddddddddddddddddddddddajddddagdddddamddd#cdddddjjdddddcdddddddddd.bngddddjbnfkjddddcddddddddal",
+"l.dddddddddddddddddddddddddcddddgdddddddddddddddddddddddjedddibedddcdbeddc#dddddcmdddddhlcdddjddddddcendddddddchhnidddddddddddjl",
+"lddddddddddddddcdddjdddddddddddmmdddmmdddddddddddc.ddddddddddcdddddadddddclcddddmcdddddfkedcdcddddddifgdddddeddbcladdddddddddd.l",
+"l.dddddddddddddbmddcdddddddddc.cdddddddddddddddddcaddddddddddddddd.fddddddajcnddjcddddgjeejgdnhdddddddndddddcdbmhlhddddddddddd.l",
+"lkddddddddcddddbidddddcaddddjcdddddncdddddddddddddnicdddddddddddddenfnadddcanedddccd.kide.c.ddddddddddkddddddc#cjmddddddddddddml",
+"l#cddddddcfddddhnhbfcdefddddhddemdel.dddddddddddddddddddfkbbkdddddddddbddddcidddddekhedd.jddeabcddddddjedddddcl.ecdddeddddddddal",
+"lllhddddm##ddddc..ecdddddddddddddddbaddmdddddjddddddddddcccccddddddddccdddddddddddddddddmidddccdddddbkddddddddmbjddddnbddddddill",
+"llll#nngllgdceeecdddddddiecddcdddcddddddddddhjddddcddddddcddddddchdcccccdcddcccdc......ekiecccceee.bllkj...........j.flfhm.mnlll",
+"lllllllllllglllll##gnl#llllll#g###ff#gn##lllll##gg##ggggg#l####llll#llllglllllllllllllllllllllllllllllllllllllllllllllllllllllll",
+"lllfieehllfhihijmjmimjjmknjjmjjjjjmiimm.mjf.mmmm.jmmemmhbkbnlggggfnanff#l#bannllfflnbbmjmhiijjiihhhi..e.eecccccee....#lgieeehlll",
+"llhdddddcnjdddddddddddddddddddddddddddddjgaddddddddddddddddd.cdddddddddc.dddddbadkaddddddddddddddddde.cmddddddddddccd#nddddddm#l",
+"lhdddddddddddddddddddddddddddddddddddddhagbddddddddddddddddddddddddddddddddddddddddddddddddd.edddddd.ie#cdddddddd.#ndbddddddddil",
+"bddddddddddddddddddddkmdddddecdddm.ddddcdgjdddddddddddddddddddddddiddddddddddcdddddddibcdddchiddchaamddjcddddeedchh#ddddddddddel",
+"mddddddddddddddj.ddcknghmdddcddddemddddddg.cedddmddddd.jdddddddcddjddcddddchaancddddjlgeddcb#iddnncceddcdddcdddc.dc#cdddddddddd#",
+".ddddddddddddddddddecdeggdddddddddddddddd#.ddddd.bihjjkdcfeddd.eddidd.dddc#mddjmdddedbdckidcghdhlheddddddddkedd.cddfcdddddddddcg",
+"jdddddddddddddddddddddddjddicddddhmdkidddedddddddcefhcddddddddd.edceddddhncdddddd.dddddc.ddegmdgmm#hdddddcddddg.dddcddddddddddc#",
+"bdddddddddddmeddddddddddddceddddcdddfhddddde.ddddddacdddkkkddehjedjjdddd.edddddddddddcjcdddeecdfmdenddd.ecddddbcddddd.ddddddddhl",
+"#cdddddddcmdeddd.mddddddddddddddjnedfhdddddilhdddddbdddcbheddedddddddddddddb.ccccdddcbl.ddddjedejddedddecdddcddddddddfhddddddell",
+"lbdddddddgjddddddddenedddddddcdddeedfhdddddd.eddddcadddddddddddddddddddddddeeccccdddc#feddddddddddcddddddddddddddddddnliddddb##l",
+"jmdddddddecdddddddmhicddddddjnmjiimd#aee....mm.cddekddddejcdddddd.cddddddddddddcccccceddddddcccddcccdddddddccddddddddcm.dddcmeml",
+"ddddddddddddddddddddddddddddflllll#dlllllllllllm.ddaddddnl#ddddddicddddddddddddnlll###ffffmh##g#f#ladddddd.ll.dddddddddd.hfgl.el",
+"ddddddddddddddddddddddddddddgllllllclllllllllllj.ddcddddd..dddddddddddddddddde.lllllllllllhalllllllfdddddddhlemedddddddebflllcel",
+"dddddddddddddd..cddddddddddc#lllllld#llllllllllnedddddddddcddddddddddmhkcddddd.llllllllllliflllllllgdd.gfmddacddddddddddddcmjdel",
+"ddddddddddddddddddddddddddd.llllll#d#llllllllll#kkddddd.hbfddddddddddn#cdddddejlllllllllllmflllllllledcjcddddddcdddddddddddibe.l",
+"dddddddddddddddddddddddddddhllnnffndngggglllllll.edddddcllgdddddddddhgcdddddddnlllllllllllmlllllllllhddddddcddcjddddddd.bddili.l",
+"ddddjddccddddddc.i.ddddddddnlnddd.eddddddkllljglhmddddddm.gedddddcd.lmejicddcc#lmmmmjiiijicijijijhllfddddm.eeddddddddddhnddmlm.l",
+"dddeedddddddcmjieccdddddddd#l.dddecddddddhllleil#cidddddddddddddccdalnl#.dddcallncdddnefj#.#cfcgcdnllcddd#nklcdmcdddcdda.ddel.ml",
+"dddddddddddddjcdd.cddcjdddkl#ddi#######ikhllleellbecddddddddddddiddhnh.dddd.mllllfe...bkbkbbabbkmemllidddh.dkfdmcijddddddcdd#mel",
+"dddddddddddddddddkcddh.ddcllndcglllllllhehllledallckcddddddddddmbdddddddddccall#llg.he#lllllllllnmefll.ddccdc#mddfiddddde#eda.el",
+"ddddddjncddddddddh.ddadddkll.jmllll#bllhjillledd#lgcmddddddddddkjdddddddddehllbdfllgd.e#lllllllllenhllnddcddd.lkd#addddn.gedmcel",
+"dddddddmddddddddddadddddillhedfllll#illhchlll.mkjllneccdddddddddccinddddekhllfcdcnllnec.nllllllllgmcbllbddddddebf#bddecg.acdddel",
+"ddddemdddddddddddcn.ddde#l#ecmlllllle#lichllledd.hllacbdcdddmcimec.cdddkccll#cmcg.nllgcac#lllllgll.a.#llmddddd.ddcdddkjcefcdddel",
+"ddddc.mdddddddddddddddcllldcclllllll.hlidhlllmj#ecklllececddcdddcddddim.befl.c.#dmm#l#dd.e#lllgd#llcdmllljddddcddddddjleddd.dd.l",
+"ddddcdddddddddddddddd.#lliddhllllllljclhchllleelnmeilllbdjem.dcdmdcchchglgdcmm#l#mhckef#memahijdhlmjcgllllacdddddddddelcdddjcdml",
+"mcddmedceddddddddddcillllnc..#lllllladbhchlllmjllnmejglambmmmcaebd..hglllndde#lllg.fehll#ebcgllhcjk.gl#k#llfedddddddddhdd..ee.hl",
+"liddicdekcddddddddeglll#ll#.cc#lllllled..hllleclllgmiejcllll#fhan#lllll#mmdmlllllllcejglllejeflledcfllmdcflljjmcddddddddjl#####l",
+".cdd.m.cdddddddehhhllbedfllfeceglllllndd.hlllimllll#j.i.if#lllllllll#bmjc.allllllll#jhenll#me.fmdde#le.dikjnjll#nkim.eddh.ddddel",
+"#kddchh.ddcikagllleamcdd.fllfcb.#llllledchllle.llllllnjea.jibnllllkmcddjjfllllllllllg.nefll#mkdeenc.jcea..eeh#lllllllicfcdddddcl",
+"cdddddddddmlllll#kcd.decad#lllckc#llll#dj.llljjllllllllf..jkjdjlllcdddddmjjjhmijhiijmmdddlllledc#l#cdcfllhdmjmjflllllfdgndddddc#",
+"ccdddddddd.lllnee.jecal#.icgllgmejflllljcdm#l..lnigllllll#fbedilllcdjckdajikdkciej..jencdcnll#j#llmiddka.igk.enec#lll#ccfndddddg",
+"fgfcdddddd.llljdcm.kllllgj.jfllfehe#llliddd.nm.llaeiglllllllkmelllhmjjjiijjjiicmiiiiijihkknllllllhcmnkcdhlll#bjcd#lllnddeghib.c#",
+"lncdddddddmlllmcmlllllllll.md#lljdad#lliddddd.illlljdkllllllkdilllllllllllllllj#lllllllllllllllljijfll#hglllllli.glllcdncdfhhlcg",
+"mdddddd.ddjlllmjhllllllllllmkdamhg.jjglicimdddcnllllhdm#llllkimlllbkbkhabbkbkbehbkkbbkbkkbknllljmcfllllllllllllimgllledbaddddhjg",
+"cddddddcddjlllmdillllllllll#mie.ll#...#idblidmjdjng##.d.#gnhe.mlllcdejbchcaeh.hiejcjehdiddcnlljejnlllllllllllllj.glll.ddcddddijg",
+"cdddddddddekafe.hllllllllllll.c.glllmkdedklladddddddeeddd.jmdk.lllcddccc.djccdced.dmdeddddglljbefllllllllllllllhfglll.dddddde#cg",
+"d.dddddddd.abkceillllllllllllljjcnllgeacdklllmeddddddchcdgllhcmlll.jg#gggg#g##gg###ggg..cgllmkeglllllllllllllllmcejjjddddehbkcdf",
+"chmdddddddjlllm.hlllllllllllll#jh.all#eddbllleenmcdd.#lkcjllhi.llleclllllllllllllllllh.inllhcmnllllllllllllllllj.agfnedmhhcddddf",
+"ckgdddddccmlll.cklllllllllllllll.dcgllledalllhmlllfalll#ddalkdmlllmmllllllllllllllllindfllmdeflllllllllllllllllmd#lllemllljkhddf",
+"cm.dddddddjlll.mi########lllll#ll.cdall#eklll.mlllllllllide#kcc.m.celllllllllllllllicefllmkcfllllllllllllllllllim#lllefaeedb.ddg",
+"cddecdddddjlll.dce...mcjemm.mcme.ccdcall##llljjllllllllllf#lkdeg##.jllllllllllllllkcekllh..alllllllllllllllllllmcllllmlcdddnddd#",
+"cddcdddcddkllled.mjj.hdjdhiehdkekejdddfllllllijlllllllllllllh..lllemlllllllllllllhke.elm.mflllllllll#hlllllllll.d#lll.#cdddbddcl",
+"cenddddddchlllgfffffnnffffffnfcnnnnnfn#lllllle.llllllllll#ahedmll#e.fllllllllllljieflkcj.flllllllllnc.lllllllllmdllllejidddbddcl",
+"d.adcdddddjlllllllllllllllllll.llllllllllllllccgllllll#ajceedd.lllcdemb#lllllllkehnllbeealllllllllbeidgllllllll.d#lllednmddfedcl",
+"dcgcm#cdddjlllllllllllllllllll.#lllllllllllllceegllllhdeabecdeillgcdgmidhlllllijmnllheaallllllllf.j#lchllllllnedd#lll.ddmddifdcl",
+"ddenm.feddillllfffanannnffffffcnfgfgfggg#fgllfek.flbejikehng#lllll#fbmciccbllik.flliienlllllabhjkglllke#lllb.bddd#llledddcdklccl",
+"deddddeiddjllllkedddddcd.c.c.ee.d.cj.ece.dcbllg..mim.n.eblllllllllllllhecbdjkm.blla.ebllllllbnglllllll.il#ji.hingllllecmcdddkicl",
+"ddddedjjddellllll#.ddd.dkeb.jmibdaek.kiibdddalll..dmcnlgd#lfahijibgllgcl#m.hdjnllhchbllllllllllllllllladhmbcillll#khjde#lfkbgccl",
+"ddddcdjeddcee.ialllfemedknnnnnnnnnnnnnnnafme.bllg.diglllc.eddddddddcmejlllbccfllhj.nllllllllllllllllllledcmfllghjmhmaecgemj.cdc#",
+"dddd.jkcddcmcmddckglljmcm#lllllllllllllllllijebllghlll#iddddddddddddddeflllakllbjeklllllllllllllllllllncdc#l#kci.eddecdaedddmmcl",
+"ddddddddddddddddccdbllhmcelllllllllnglllllll.ackllllladdddddddddddddddddmlllllidjalllllllllllllllllllfmgddkfcfcdddde#edddck#ljcl",
+"dddccdddddddddddddecm#licjmllllln..a#llllllll.ddblllkdddddddddddddddddddde#ll#cdclllllllllllllllllllljimncdijcdddddil.d.a#niedcl",
+"dddddddddddddddddddddeglmedflllnde#lllllllll#cde#llkdddddddddddddddddddddde#llkccallllllllllllllllllkjjlljdccddddddbl.e#lg.dddcl",
+"ddddddddddddddmjdddddd.l#en.lllmdbllllllllll.cclllbdddddddddddddddddddddddd.llljl.lllllllllllg.llllnjeflacddddddcddal.dd.bl#edcl",
+"ddddddddddddddmidddddcdjlncdbl#cdmlllllllllgceillfddddddddddddddddddddddddddillg.chllla#llllln.llllijhllebdddddjdddnlj.ihdm##ccl",
+"dddddddddddddd..dcddddddflciefjdddig#aallllhcc#lljdddddddddddddddddddddddddddlllebelll.llllllnelllgjk#laidddddmbddcf#ggffmdgfdcl",
+"cddddddddddddd..ddddddddmlmddcfgeddd.allll#cghlladdddddddddddddddddddddddddddmllgcdgll.llllllbclllie.l#dkdddddfjddddddddddmbddcl",
+"ddddddddddddddciddddddddd.ddmmlllgg#llllllaccjgl.dddddddddddddddddddddddddddddfghefhllmllllllk.lllejnlaacddddd#mdijddddddddddddn",
+"dddddddddddddddbk.ddddddddajedllllllllllllj.cmemddddddddddddddddddddddddddddddc.hjmclljllllllk.ll#eelljnddddddf#afaijjjmm.mihddb",
+"cddddddddddddddddccdddddcelnddgllllllllllledjlljddddddddddddddddddddddddddddddjllb.mflm#lllllijlla#hl#hidddddddc.hbbnkki#fb#nddb",
+"cdddddddddddddddddddddddddg#eenllllllllllledbllmddddddddddddddddddddddddddddddellgecnl.gllllljjllhehlfecdddckmddcjmmedddbedfiddn",
+"cddddddddmkdddddddddddddceale.blllllllllllccflleddddddddddddddddddddddddddddddd#l#ckbljfllllljilljbblkhdddddj#aedgllgcddmcdamdcl",
+"cddddddddcedddmdddddddddddhl.hhllllllllllgce#l#ddddddddddddddddddddddddddddddddfl#cjcjd.hkhhhcehhcdnlidddddddel#edil#cdddddmcddf",
+"cdddddddddddddcdddddddddccbljdcj.m.jeieiemddll#ddddddddddddddddddddddddddddddddflledmhddcmha.ccbcddnljhdddddddjmcdd.nddddddddddf",
+"eddddddddddddddddcmdddddccblmc.i.jeheichcjcell#ddddddddddddddddddddddddddddddddfllmce.edce.medc.ee.#ljeddddcdddddddddddddddcdddf",
+"edddddddddddddddddhiddddemfllllllllllllllllllllcddddddddddddddddddddddddddddddc#lllllll.#llllcallllllkkdddddddeeddddcdddddhhdddg",
+"edjedddmdddddddddddimdddddfllllllllllllllllllllmddddddddddddddddddddddddddddddclllllllljhlllgcbllllllf.cddddmknfddddddcddd.gddd#",
+"ecfeddddddddddddcdddddddcc#l##########llllllllliddddddddddddddddddddddddddddddmllllllllhelllfdalllllllhhddddddcgbdddddccejaljdd#",
+"eddcddddddddddde#gcdddddd.laddddddddddddccccellfcdddddddddddddddddddddddddddddbllgjiihied.mmede.jjiklljedddddddilcdddddl#nhmcdd#",
+"e.dddddddddddddd.fcddddd.hljddbcnckckmjeeidddglledddddddddddddddddddddddddddddgllmddidacddieddcbckddnlamddddddd.lc.gkddabdde.dd#",
+"eicdehadddddddddccddddddcgled.mmjcmjjjmmjmmdealliddddddddddddddddddddddddddddcll#ee.mmjm.dejcdcmjmed.l#ciddddddcl..l#cddbedaljcl",
+"eieaadidddddddddddddddc.hlnhjllllillllllllljn.bmccdddddddddddddddddddddddddddm.fh.mlllll#dklidalllgddllfcdddddemlmilgcdddcd.lmc#",
+"ejgmd.jdddddddddddddddcdglccmlll#klllllllllnd.ck#bdddddddddddddddddddddddddd.lnmdk.llllllecnjdalllljaillmiddddmglenlgcddddddfjc#",
+"kkddddcdddddddddddddddcblb.enlllablllllllll#dk.llleddddddddddddddddddddddddcgllahbnllllllbdccdallllaecfl#e.dddd.ncflnddddddd.id#",
+"mdddcdddddddddddddddddjlfccillll.nlllllllllladjbllledddddddddddddddddddddddfllgdcillllllll.dddbllllligmllgckcdddddccdddffgfnajd#",
+".dddkddddddddddddddcddalei.#llllcflllllllllll.kcgllgedddddddddddddddddddddnlllmemflllllllladddhlllll#cjjllgjm.ddddddddca.....cc#",
+"mdddddddddddddddcdedibc.cdfllll#dglllllllllllfdd.lllgeddddddddddddddddddcalllkddillllllllll.ddhllllllamekll#.eaccdddddbgedhdbcd#",
+"jdd.edddddddddccicdfl#cdcalllll#dffhbf#llllllnddhlllllkdddddddddddddddddnlllllmcdblllllllll#ddilllllllac..lbmnc.bdicedcedddcjdc#",
+".ddfgcmmdddmemcemn#lfemdallllll#df#nbmcejallaeh.#la#lllgjcdddddddddddmagm#lb#lli..blllllllllmdmllllllllachec#l#nh.mcjddcddddddd#",
+".dd#lfifddc..jkgll#kcecnlllllll#cblllndjed.kdd.llgd.fllll#ideccccc.iflllh.edmllle.dfllllllll#eelllllllllacich#llll#fhdddddddddcg",
+".dde.ikkcd.lllllfmc.cj#lllllllllj.lll.d#lidddjllnddc.m#lllbhlll#lllllllljceddelllikebllllllllnelllllllllllid#cek#lllfddddddddmgl",
+"mdddddddddjlllheemcjalllllllllllfdhlhdkllacdd.gfccmm.kjif#mgllllllllllliddekc.i#llhcjhllllllllillllllllllllnidhdclllfdddddccd#ll",
+"mdddddddccillledd.bllllllllllllll.dicellnecmcdcdc.l#hjj.cecn#####gfhjllidellg...lll.hcallllllllllllllllllllllf.dc#llgdceddmadkll",
+"mdddddddnhmllledbllllllllllllllll#.ddflacbklgcddjlllllaednjkecedc.mdcllijmlll#eac#llcickllllllllllllllllllllll#.clllgddgcddnmc#l",
+"mdddddddhijllledblllllllllllllllll#hblncdillfcddfllllll#nh.me.mejcmdc#li.jllllf.kjf.hhcmhlllllllllllllllllllll#.clllgcdakialadgl",
+".dddddddbmjlllecbllllllllllllllllllllfcdmllgcccdillllllllll#gnbbbfkecllj.mlllllfjecklleadnllllllllllllllllllll#cclll#dddccefadgl",
+"mdddddcdddde..ddejiikhhikhabbaaannaaidmillfdcjgddfllllfbllllllllllamclljcmllllll#mfc#lliech##l###llll#lll#llllf.clllgdddddjl.cll",
+"mdddcddddd.fnfededmjcmeickdbeici.emdddm#lge.m#lidjlll.cnllllllllllaeclljijlllllllg.jmglljddc.iehejejimick.mejidddlll#edddenjdall",
+"nmcjkdddddjllljmee...m.ceme.e.eeececc.llgcd.lllgcc#amdilllllllllllaicllicmllllllllgmme#lljddknegj#cbgmbdfmbkjbmddllllg.ddddddfll",
+".dddddddddmllllllllllllmnllllllllllllllfc.illllleddcednlllllllllllaeelljhmllllllllll.bcgll#g#f#ffbfbagfnficanbabbllllgidddddddjl",
+"edddddddddmllllllllllll.nlllllllllllll#cj.#llllncjn#lgllllllllllllb.c##jejllllllllll#...flllllllllllllllln.lllllllllgcddb##gcncl",
+".dddddddddilllieeeee...dem.....mjjbllfcd.lllllndflllllllllllllllllbedeedimlllllllllll#edclllnkbabanaangggbcgfffgglllbdcbfehhd#e#",
+"jdicdddddfllll.dmdbenei..bdidicddjlllbdmlllll#c#llllllllllllllllllbcellmjjllllllllllllledflllhdddkda.nmmheadmdmdd#llhdkndecdd#.l",
+"idcddddcflllll.dmkbkhkkkkkkkhdcdjllllbejlllllf.lllllllllllllllllllbjellj.jlllllllllllllmdfllllkdceejmj..i.h.meedd#llfddg.cjdcl.l",
+"idddddddcflllleealllllllllllnddmlllllbjjllllllkhllllllllllllllllllbcellmjjlllllllllllllmjglllllijchllllllllllln.c#llnddiadaddl.l",
+"iddd.iddddjllledhllllllllllhdchllfc#lbfilllllllehlllllllllllllllllbjellmcilllllllllllll.d#l#dfllhdeillllllllllgdcllladddbcmmd#cl",
+"idddjbddddmllleddcja#lllllbcdhllfcc#lbeilllllll#chllllllllllllllllkc.ll.hjlllllllllllll.jglgdcfllbcdilllllllgbeddlllnddd.cdkcgel",
+"jdccc.cdddmlllai.dddcalllaec.llfddc#lbhhllllllllacnlllllllfbm..e.eccellmccmjjjjjjjjijjjdd#l#dce#ll.cdkllll#idcee.lllnddddcdh.#e#",
+"iddchjdkddmlllllllccddcaidei.nadcdd#lbcilllllllllkdalllk.ckci..hchddd#l.dcndndnijkcfd.ncd#lfmcdcg#dic.illjedeh#lllllbdddddd.l#el",
+"idegiddiddcjjiaglah#bcedddjlgdcime.#lbhhlllllllll#cchkehe.mikaannbimillijjiiijiii.dijjmjjllfemjhc.albc.jjehb.#lllll#mddcdddcgl.#",
+"hdeeddddddddddddedfllg.ddmllgdd.lec#lbcillllllllllfcdc..jfllllllllllllllllllllllln.llllllllfcile..#llijdjj#lhelfh.cdddddddddhle#",
+"iddddddddddddddddddhlllbillbdjjllmhglbkhllllllllllbddd.#lllfkj..mia#llll#kbkbhbab.ebnaanallaiillmdcfllkcglllgcddddddddjcddddc#c#",
+"idddeddhcdddddddddddmgllllhd.mlll.c#lacillllllllla.icddhfjmded.emccemb#l#hddd.hckeie.eddd#lndill#jdcfll#lllkcdddddddddcdddd.ijc#",
+"hddcneckieddddddcddddcnllgddellllmiglabhllllllllk.cigdddddmddddddddemc.fllacdcjckebem.dddllnmillllcdd#lll#mddddddddddddddceemdc#",
+"iddcedddddddecdc#fdddddbllkdc#llled.kmchlllllllaecallmddddddddddddddddc.mllgcdelll####g.ellndillllnddgllgcddddddddddddc.kdnmddcl",
+"mddccddddddddddnambdddddnll.cellleckkmahllllllgcjillkjeddddddddm.dddddd.d.#lfdcjlllllll.c#lajilllledkllgcdmngfakiddddddi#.cecdc#",
+"mdddddedddddddc#.daiddddc#lncealled#ladhlllllljgmllhcmddddddddjl#ddddddddcc#lhdd#lllllljj#lbdilllnmjll#cddblidddcdddddj#.mcddddf",
+"mdddjncddddddeljdddfdddddml#.dellecglbnhlllllaedglachdddddddddegkdddddddddi.lledellllllec.mekhll#edfllmdddd.gidkbdddddc#.ddddddk",
+"iddmkcddddddcajddddbidddddjmiccbled#lbchlllll.hil#dmddek.ddcddddddddddddddde.ejddblllllmmllndillkjjllbddddddefabdddddddjfcdddddk",
+"jdddddd.idddindddddi#dddddd#lmd.led#lbfhllllfkjllhedddgl.mgfcddddddddddddddednljdmlllllecllnhkll.d#llcdddddddd#iddddddddafdddddb",
+"mddddda#iddddcdddddmlcddddd#lfddedc#lbcc.mm.ceilgebddblekgjdddddddddjeddddddmjlgdciikimccllac.kicellfdddddddddcgdddddddddcdhdddn",
+"idhhkbjjmdddddddddd.l.dedddnllcdmcd#lbdekchdddnlh.ddcliekcddddddkcdddc.ddddd.d#lddejebddclladdjddmlljdddebdddddmidddddddd.bfdddg",
+"#cnacddidddddddddddel.dacddhllnkhkbllgihhdmkkh#l.kddelcdddddddddkeddddddddddd.al.ceic.cdclladdecdalgdd.jaeddm.ddedddddddjllgcddg",
+".dbgdddddddddddddddcicdbeddellllllllllllleflllllmiddmmdddddddddddddddddddddddcilllllikllllll#gc#llladdil#ghdjkdddddd.ddcemlbk.mf",
+".ddcdddddddddekedddddddecdddgllllllllllllefllllgceddcdddddemeddddddddceeddddde.llllliklllllll#cllllhddijjjiddddddddddddddefdddda",
+"edddcdddddddddddddddddddddddbllllll#lllllcfllllnccdddddddjll.ddddddddnlleddddcellllljklllllll#clllljddddddddddddddddddddddiddddi",
+"bmeddddddiiddddddddddddddddddccccdddhaannda##gge.dddddddddmndddddddddflleddddddk#gfn..anf##l#gcg##lmdddddddddddddddddddddddddddh",
+"ll#cdddddb#ddddddddddddddddddddddddddddddddcddeddddddddddddddddddddddk#fcddddddddddddddddcccccddcccdddddddddddddddddcbidddddhffl",
+"ll.dddddddjddddddddddddddddd.heddddddddcccddddccdddddddddddddddddddddddddceddddckddddddddddddddddddddc.ddddddcc.jdddmgedddddd#ll",
+"lnddddddddddddddddddddeddddd.mjg.ddddddddcddddcdddddddddhhdddddacddddddddhnddddfcddddddafddcdddddddiflgddddcdcddccddeedddddddjll",
+"liddddddddddddddddddddmcdddddddi#cdddddd.cddddcfakkddddd#iddddhjdddddddddbndddmnddddddel#ddjcdddddcmm.addddcemeiadddddddddddddgl",
+"lmddddddddddddddddd.dddddddddddiaddddmdjlndeddddd.gdddddedddddddddmacddddhndcdebddddddkllddddddddddcebaddddddddkcdddddddddddddfl",
+"lidddddddddddddddddddddddddddddcddddd.dca.dddddddel.cdddddddddddddejce.mdelehmd.dddddc#.ldddddddddd.mhadddddddfnddddddddddddddfl",
+"lndddddddddddddddddddddcddddddddddddddcdddcmdddddel#jddddddddddddddmhhbfddffa#cdcccc.bemlcddddddmiddddfddddcdclndddddddddddddc#l",
+"llhdddddddbcddddddcmjdc.dddddddddddccdddddcedddddencdd.iiab#hddddddccc#iddcglneddcmhmddjlcddddednhddddbcddddd.llbdddi.dddddddbll",
+"lllkdddde##ddddddd..cddddddddddddddccddddddddkjddcddddccdcejmdddddelchlcddd.cddddddddddjlcddckmdddd.gmdcddddddccddddkgcdddddelll",
+"llll#nbflll.ddddddddddcddddddddddddddddddddd.l.dcdddccddddddddddcnccdccdddddddcdddddccdkleddddcddd.#lg.eeeeee.eccdcdal#im.jb#lll",
+"lllllllllll#kbbihjkng#ll#nnaabijbbbnhi...jha#llg##gf#l##fffnkhhkflakababbbnfgf#ngffg#l##lganf##ffnllllllllllllllllllllllllllllll",
+"llllgnglllk.ee.......mjjhikiceceecccccee....ee.....mjijm.e.e.e.eecceeee..m.mmmm.alllllllge.meeeeeee.e..mjj.m..eeche.eallllllllll",
+"ll#jdddmfljdddddddcccdddddc.dddddddddddddddddddddddddddddddddddddddddddddddddddd.#nhiia#jddcbaababbahddddddddddddhdddhlfjcccilll",
+"ll.ddddddgicacdma#l#mdddddcmdddddddddddddddddmhdddddddddddddddddddddddddddcnedddddddddddddddddddddh.dddddddddddddcdddh#dddddde#l",
+"lkdddddddcccled#nmcddddddddiddddcddccddddddddd.bdd..ddcjeddddddddddddfcdcajl.dddddchnamddddddddcddddddiddhdddddddddddccdddddddml",
+"leddddddddddnddcdddddkdddddaagcdbedddddddddddddicddkd.ahkdc#jcdddddddacdccdgeddddcnanijcdddddddddddddddcnjcdddddddddddddddddddcl",
+"fdddddddddddddddddd..ddddddddddk#cdddddddddddddc.ddhkl.dddclkidddddddbcddddfddddddddhjdddddddddddddddddeee#ddmddddcdddddddddddd#",
+"gddddddddddddddkaddddcddddddddhacdigeddkedecdddccddcgkddddcgdddddddddkdddddbddddddddaedddddede.dddddddddj#jdi.dddnjdddddddddddcl",
+"l.ddddddddcdddd.bmddddddddddddidddflhddaabiddddddddd.cddddcfdd.hkiedddddddcgbmdddddi#.ddddddcicdddddddddmjbjidddcg.dddddddddddml",
+"ladddddddiadddddddddddddddddddddddjljddekdddddddddddddddddefddeeddddddddddddddddddhmceddddddddddddddddddddbkddddddddd.cdddddddfl",
+"llnddddd.lbdddddddddddddhdddddddjddddddddddddddddddddddmddebdddddddddddddddddddddddddddddddddddddddddddddddddddddddddh#cdddddfll",
+"bkacddddikmddddddddddddcfdddjkbalabkkbdiijijmm.cdddddddcdd.iddddddddddddddddddddddddddddjcccdcccccnmddddddddddddddddd.kcdddd.aal",
+"edddddddddddddddddddddddddddgllllllllld#llllllljicddddddddhjddddddddddddddddddchbkhimmcj#ll#ellllllkddddddddddddddddddddddddddda",
+"eddbkddddddddddddddccedddddd#lllllllllc#lllllllb.dddddddddfjddddddddddddddddddmllllllllllll#.lllllladddddddddddddddddddddddddddb",
+".djndddddddddejdee.jmfjddddelllllllllld#lllllllg..ddddddek#mdddddde.ddddddddddkllllllllllllgmllllllfddddcdddeddccdddddddddddddda",
+"mddfidddddddd.dddddddijddddilllllllllld#llllllll.eddddddddn.dddddcgcddddddddddnllllllllllll#jllllll#ddddgcddgekllndddddddddddddf",
+"jdddifcddddddddddddddndd.ddbllecccmemecemem.ejllj.dddddcngledddddhkmafnfcddddd#laiinllmjijjmchkhhblliddclcddklfmecdddddeg.dddddl",
+"jddddegiddddddddddddnjddhddgl#ddhckcbciek.bdddnlnccddddddeiddcadd.gh..ekdddddilldddhl#ddijeiimc.dd#lfddc#id.gbddddddddd.aahddddl",
+"idddddm.dddddddddddhaddccdellik.fnfnaaaakkih.djlli.ddddddddddjhddd.dddcddddddllgdddbllcdemdceeceddbllcdd#gclhdddijdddddddddddddl",
+"iddddddddddddddddbb.ddddddgllceblllllllllllled.llfe.ddddddddd.ddddddddddddddillhickalldcnggggggfjcclliddklljddddeeddddddddddddcl",
+"hdde.dddddddddddclcddddddjlln..#llllllllll#jcm#llljccdddddddddddddddddddddd.llfce.bbllchglllllllgecblledc#fdddddddddddddddddddcl",
+"hddigdddddddddddclcdddddc#ll.dhlllllllllll.c.llnnlljcedddddddddcjddddddddddgllmakm.alldd#llllllllifmllnddecdde.dddddddddddkmddel",
+"hdddbcddddddddddel#n.dddfllhe.glllll#lll#ejmllfcc#llhcddddddddddeddddddddc#llhc.ljgbl#.hgllllllll#cmjlladddddd#fjdddddddddddddel",
+"idddemdddddddcddchedddcallledmlllfkjnll#mc.#lfeddmlllh.ddddddddddddddddd.gllnejnlm.nl#c.lllllggllliddfllidddddghdddddddddddddd.l",
+"mddddddddddddkhdddddddnlllljddfnednlllledcel#cidc.ell#ccdeddddddddddcedehllndcbllmgflle.llkedd.lllledd#llidddde.dddddddddddddd.l",
+"mdddddddddddd.leddddeglllfllhjdd.#lllgcmjlbcche#g.c.bcflnmd.e..cdcidckgljjicihlll..nl#dd.cddddellllmddhlllnddddddddddddddddddd.l",
+"mddbedddddddddedddeehlllmdbl#dddglllfebm#ln.cj#ll#.jdillllfkmm.e.mhallllfdhmillllifnlfddddceddelllmjhblllllgjcdddddddddfffbeddhl",
+"mddalcddddddddddenl#d#gcdddnbddmc#llebell#ckc#lllll.ec.flllllllllllllllkmndalllll.cfbddddeflddcll.jdblllnnlll#mdddddddd#dmdddcgl",
+"mddde.dddddmibn#llllkcci.ekccdnidmbecjllfc..#lllllllacccikgllllllll#ni.nei#llllllmkdddddallledda..ialllkdd.glll#fkj.dddbcdddddml",
+".dddddddddcllllllllfmcjef#eddel#mjdiillfedcejjhiihhhhjccjdd.ihlllajeciejnllllllllmmddddellllkdddhcalllbcddickgllllllbddhmdddddcl",
+"mddddddddddllllllhec#cjlll#dddglledelllcddhca.kch.#mibim.dddddgll.dddiglllllllllleddenjk#llll.ddcblllhjgebcejdmbllllgdddcdddddcl",
+"mddhmdddddcllllmcjeejfllllbddkcfl#klllnbbbbbkkbbk..hhhhihiiiihlllmmhllllllllllll.ddm##cmllll#.ddilllkb.jll#b.mcddnllgdddddddddcl",
+"idddacdddddllllcd.iflllllledeckm#llllllllllllllllknllllllllllllllmiklllllllllllndddfl#.hlll#ebddcflkekhllllllamddfllfdddddccddcl",
+"bdddmamidddglll.mllllllll#ddb#cdd#lllllllllllllllballllllllllllllmdallllllllll#ddd.fl#ejll#dcdfmddchnhlllllllllmdfllfdddddddddc#",
+"bddmnke.dddfllle.llllllllgddnlgeheflgecce.eee....ccm.mmmmjjjjilllmbklllllllllljdcddfl#cml#ekmnllhddehllllllllllhgfllfddeddddddd#",
+"bddibdd.dddglll.hllllllllgddallncbm#lfcdefcbdn.gendbefeaeijecclllmeallllllllllcc#.jfl#e.geicgllljdddhllllllllllmmmiimdddddddddd#",
+"bddmaddddddglllc.llllllllgddklllgimc#l#cede..eececcdcdddddddddhabdhalllllllllidklcdfl#.edceflllekjkkddblllllllljbn#gkddddddddddl",
+"bdd.addddddflllmmllllllll#ddjllllne#m#ln.eillllllllll#######ecaaaehblllllllllcilljanl#ccncfll#mhebll#ni.mhblllljiflladddddddddd#",
+"bddckdddddclllle.#g#llllll.d.lllllnemillni.illllllllllllllllijlllmeallllllllgd#ll..fl#ddegll#mcialllllllgffllllmmglladddddddddd#",
+"bdddjdddddd#lllmi#.demihbamdd#lllllnehellamajlllllllllllllllccllleinllllllllkblll.hflgdc#lllcbbnlllllllllllllllj.#llbdddddce.ee#",
+"bdddddddddcllll.mllghcddddddddcce...dddmaamcmhlllllllllllllljhlll.cnllllllllmllll.iglge#ll#mmeblllllllllllllllljigllbdddh#lfflll",
+"bddddddddddlllliillllfmdddddddddddddddddddddddemjikbaanfgg#lmjlll.hallllllllmllllje#l##lllmddebaanffffffffggg#fe.#llbdddcfl.dc.l",
+"addddddddddllllcellllllhddccddehjmjijijdedjiidddjibaababbhgljjlllednllllllllllllledllllllcddmm.eim.jcd.djdjdedcdd#llbdddddggdddl",
+"bdddddddddd#lllmhlllllll#llfddillllllllhebhllbdcnllllllllllgjjlllehblllllllllllladd#llllaeee.e.e..cecccdmcmc.dedd#lljdddddc#kddl",
+"bdddddddddd#llle.llllllllll#cdcllllllllljb.hlladcnlllll#fi.ddclllcdcebgllllllllfede#lllllllllllll#cag#ggggggfnfnnlllmdddheda#ddl",
+"bddddddddddllll.mllllllllllleddflllllllllmf.hllabeflllicjifddclllcdj.je.flllllne#.llllllllllllllllcgllllllllllllllllhdddkedhlcd#",
+"#cddcedddddglllcdjglllllllllcddnllllllllllj.nbllkmjkhckcjcianglllgnbm.emcm#llaihegllllllllllllllllcgllllllllllllllllkddddddg#ddl",
+"ndddddddddclllleddcigllllll#dddnlllllllllllmaebllhmdee.mcflllllllllllghd.hcbnejjcnlf.e....mmmjjj.mdmiihhhihhhhkhklllkdddcchlkdcl",
+"fdddddddddcllllln.cbdhlllllbdddfllllllllllllcaaklladd.glnhllllllllllllf.bdijc#jllehddcfekejk.lc#.hchbiadmcdddd.hgllliddc#llhddcl",
+"addddddddddhbgllllbmckm#lllhddelllllllllllll#m.mallabllllekjeeccce.if#.#lg.ddj#llkddc.imm.mm...mee.mm.mcmcddiglllgfacdddc.edddcl",
+"fcddddddddddddekglllk.ec#ll.ddbllllllllllllll#jidnlllll#iddddddddddddcellllj.lllfene#lllllllllllllllll#mi.mgllgb..ehcdddddi.ddel",
+"ndddddddddddddemce#llgcddgbddd#lllllllllllllllnddellllbdddddddddddddddde#llllllgdcclllllllllllllllllll.cehll#jem.eceddddddhkddcl",
+"bddjjddddddddddcdechllgckcdddnlllllllllllllllgmiegll#mddddddddddddddddddckllllnc.j#llllllllllllllllllm.kallh.cidddddddddddjbddcl",
+"bdddbddjjdddddddddmmjll#ccddjllllllllllllllllmjjfll#mdddddddddddddddddddddnllljddnllllllllllllllllllajeilljc.dehcdddddddddbhddd#",
+"adddmbddddddddddddddd.llecdc#lllllllllllllllnhhalll.dddddddddddddddddddddddbll#cajlllllllllllllllllfdehll.h.cgllnddddddddm#cddd#",
+"f.j.iledddddddddddddde..dddc#llllllllllllll#cjjllliddddddddddddddddddddddddcglln.dnlllllllllllllllljhmllihddc.iglcddddd.hicdddd#",
+"be..m.dddddddmdddddddcdddddckllllllllllllllfhiallfdddddddddddddddddddddddddd.lllci.lllllllllllllllncdb#bdmdddddelmddcdddddddddd#",
+"mddddddddddddgdddddddddddmhfjllllllllllllllicdjlledddddddddddddddddddddddddddnllhdcllllllllllllllldm.mdj.dddneddnkdelfddddccddd#",
+"jddddddddddddnkdcddddddde#lecnllllllllllll#enbfjeddddddddddddddddddddddddddddellbemnlllllllllllll#jm#l.cddddfmddikc#l#ddddb#mdd#",
+"hddcdddddddddjlmjmddddddc#l.ijllllllllllllbedgll.dddddddddddddddddddddddddddddmm.ecmlllllllllllllaihllmiddddddddg.c#l#ddddk#cddl",
+"hddnbdddddddddc#flcddddd.klbdclllllllllllljhc#llcdddddddddddddddddddddddddddddhllked#llllllllllll.khlbcddddddddd.cddjmdddddddddl",
+"idddn.eddddddddck#mddddddmlg.m#lllllllllll..illnddddddddddddddddddddddddddddddmllnccglllllllllllgdjnlmhdddddddddddjgddddddddddd#",
+"jdddbl#dddddddddddcddddd..llcdn#########l#jballjddddddddddddddddddddddddddddddellfccnlllllllllllncdlleddcdddcdddde#jdddcddd.cd.l",
+".dddf.lcddddddddcfnjdddddcll.decddcmceeec.ddglljdddddddddddddddddddddddddddddddgl#cdmkaabananfnnieml#hmdcdddbddddifdddaljdda#dnl",
+"mddnndgedddddddddcjbmddddcllmdijkmmijhihemdc#llmdddddddddddddddddddddddddddddddgl#cddjdicicicjceddil#cddddddfcddd.ndddjhfdd.jdcl",
+"jddeddjcddddddddddddddddddll#gffafffnaanfffnlllmdddddddddddddddddddddddddddddddgllmmmjmj.jcj.m.eeeal#jmdddddfeddddcdddddjhdddddl",
+"iddddddddddddd.eddddddddddllllllllllllllllllllljdddddddddddddddddddddddddddddddglllllllllljlllllllll#ccdddddfjdddddddddddcdddddg",
+".dddcddddddddi#bbkcddddde.llllllllllllllllllllljddddddddddddddddddddddddddddddcllllllllllljlllllllll#eedddddcdddddcnmdddddddcdcl",
+".dddmddddddddicddmaeddddc.llhhbbabnnnnnffnaf#llbdddddddddddddddddddddddddddddd.lll########m####l##llljmdddddd..dddjllhddddddn.cl",
+"mdddddddddddddddddddddddbmladdkmgehmcm.mckdd.ll#ddddddddddddddddddddddddddddddjllbddedcdccceddeddddfledddddddfgdddc#heddddidkmcl",
+".dddddcdddddddddddddddddcblkddmmj.mmmje.emcdd#lledddddddddddddddddddddddddddddalljddici.ee..jejedddklkcddddddckddddddddddibdbecl",
+"edddcnacddddddddddddddddm#lmmhlllllllll#l#gc.nllmddddddddddddddddddddddddddddd#ll.iifgffggggfgnggjbjllcdddddcnidddddddddenddbcd#",
+".ddddmddddddddddddheddddhllddglllllllllllllidjndjedddddddddddddddddddddddddddcj#adc#llllllllllnllgdeglicddddckmdddddddddddddhcd#",
+"mdddmddddddddeddddddddddglmimllllllllllllllnj.mflkddddddddddddddddddddddddddc#nmdkcllllllllllgelll.bmlgcidddddddddddddddddddjcd#",
+"mdddkbdddddddnncddddddddffcdbllllllllllllll#dcill#cdddddddddddddddddddddddddbllfddklllllllllliellljee#lkkcdddddddddddddddddddddg",
+"jddddacddddd.hddddddddddddmmllllllllllllllllfi.glllcdddddddddddddddddddddddhll#ebmllllllllllhdjlllljb.llcddddddddddddddddddddddf",
+"jdddejedddd.kcdddddddcdddddnllfnlllllllllllll.ee#llncdddddddddddddddddddddilllidcalllllllllfcdhllllbcjijbmdedddc#ncdddddddndddd#",
+"jddcihbjmiabddddddccc#iddddalncglllllllllllllnddilllfcdddddddddddddddddddmlllljdcfllllllllfcddhllllljkdil#maccdd.gedddddcc#cdddl",
+"jddejfedddddddddcciilladddddcdiieeejflllllllljcdklllll.dddddddddddddddddnllllllhkcnllllll#cdddmllllllch.gllkegcddddddddc#gfmdddl",
+"hddd.lcdddddc.acimnllkjdmcddddddddddd.nllllljmbbllllll.i.ddddddddddddcigllla.nllmjefllll#cddddcllllllgmcikllfidbdhd.dddhjddddddl",
+"adddjmdddd.bjijjbll#icke#ndddddddddddddilllikehll#.j#killnjccdddddcecgllllkdddfllmccflllmdddddd#llllll#ebc.#llfiehdbcccbhdddddcl",
+"kdddddddddiagllllljdkiklllfdddddebaahcddcl..dnll#eddddlllllll#gf#ll#d#llfecdcmdnlljc.f#eddd.eddkllllllllm.hcillllll#al#hcdddddcl",
+"hdddegcdddnllllajj.b.nlllllbdddalllll#bcdceinll#jadccd.alllllllllllldffjed.ngcmcgllmeccddd.#fcdclllllllllbckmeiagllln.cdddddddml",
+"eddddeddddallllce#ehllllllllbdhllllllllndddhll#..mfg.ddclll#llllll#fcccedjlllgcccfl#cddddcgllmddalllllllll#mcmdddlllkddddddddbll",
+"edddddddddkllllccflllllllllllbgllllllllehddmlgeg.glllbdellgdcc.eedchdjcbllllllfcccaedddd.llllnddcllllllllllllbcdelllbdddddddddcl",
+".dddddddddblllle.llllllllllllllllllll#.ehnhdj.cjgllllfdcllgddcddcccihn#llllllllfdddddddc.lllllhddmllllllllllll.dclllbdddidcnmdel",
+"fifbcdddddhllllcmlllllllllllllllllll#ebjnllhdkm#lllllnjmllf..bffgglllllllllllllgddddden.g.#llllcdd#lllllllllll.aclllbddddddccddl",
+"jgddddddddbllllccbnnnffkfggfggggggggeadgllg.ednllllllfcellgjhllllllllllllllllljdddddc#lgece#lll#cd.lll#llllllledelllbdkcddddccdl",
+"ehbdddddddbllllccbck.i.hcidbcheidk.ddefllg.m.he#llllln..llfdillllllllllllllgicdddejdde#l#edcee.eeddcj.c.m.m.i.ddclllbcl.ekdd.mcl",
+"ed#eddddddbllllm.jm.mj..c..j.j.m.i.cenllge#mllbelllllahmllfkkllllllllllllfmddddckllbce.#l#eccc.cecddmcccec.cieccelllbeljchdd..dl",
+"eddaddddddnlllllllllllll.llllllllllllllfcej#lllamllllncellfcillllllllfh.dddddddclllladd.lllllllll#edclllllllllllllllbdl.dddc#cdl",
+"edd.ddddddbllllnaannffnfcfgfgggg##llllnchillllllkklllajckhmmhllllbmeee.mjkngadddhlllladmellll#g#g##cdj###l#ll###llllbd#..mdijdd#",
+"eddddddddn#lllldd.dmdjccdcd.ce.ddegllgdd.llllllllk#llbeckkjjillll#ll#llllllllmdddfllllkcd.ll#eddddcddddcec.ccccdhlllbdfeh#dddddg",
+"cdddddddddjllllcdmceeeecceceeccdc#lllfdelllllllllllllkbmllacilllllllllllllllllmdd.lllllkdclll#edddeeecddcdececddjlllhdaedddddddl",
+"edddddddddhllllc.llllllllll#n.d.#llllfd.lllllllllllllkc.llaaklllllllllllllllll#.ddillllfdd#lll#cjdg###bcb#####eeilllideddddddddl",
+"edddddddddhfnakehllllllllllfc#.#lln#lnd.lllllllllllllhb.llacillllllllllllllllll#dddnlllfdd#leglgej.#lllgeallllmamlllmdddddddddc#",
+"edddddddddehbande#llllllllnjjclllhc##khmlllllllllllllhdellbnklllllllllllllllllll#eddbllnielldell#edelllllnflllcdilll.dddbfddddd#",
+"eddmcdddddhlllldcjjallllladjefllhdcmj.ccannnnnannnffnejellkcillllllllllllllllllllgmdcnlfdclldd.ll#cee#lllllgh.ddjlll.dddm.ddddd#",
+".ddmedddddilllledje.enllacamndfbmcellndcidjcjmided.cccdellb#hl##lllllllllllllllllllmdcnn.ellddd.ll#e.e#llgidjcccklll.dddddcddddl",
+"edddddddddjllllllnmec.ejhimll#cmddelladddcccec.dececdcc.llbcdeddde.jfllllllllllllllladdccel#cdce.ll#edefjdhcckllllllcddddddddddl",
+".dddddddddehkngllllfiiddmhlllhehhj.llggg####lhh#########llkdcjeeejemd.iglllllllllllllfmddel#ccjde.ll#c.ddcmb.lllgnakddddeddjbcdl",
+".ddddddddddddddek#l#lnedjlllhh.klc.lllllllllljnlllll##llllgflglllgfh.eedhllllllllllllllkddb#dd#icc.llgcdchllmaheddebbcddddde.ddl",
+"nddddddddddddddddd.glllklllmcmbllkillnccececedcccddccdc#llll#faaagllllkddcnllllllllllllnedccdm#lked.ll#m#llgeddddflllidddddddddl",
+".ddd.hdddddddddddddchllllljehalllm.llnddkdbmk.bcjedddjgllajeeedcdcemb#lgicdhlllllllllllace#adcallkdj.lllllhddddddmm..ddd..dddddl",
+"mdddhnjddddddddddddddmlllfdd.lll#kjllndcbfbanfafaedekllfccdcdcddddddddhllbcijllllllllllbe.l#mijegleddklll.ddddddddddddddhidddddl",
+".ddjadddddddddddddddddclllbimflllemllnm.lllllllli.cnl#e.dddddddddddddddcal#eejlllllllllac.lldellllcecll#cdddddddddddddddbcc#cdcl",
+"mdcg.dddddddddddddcdddde#lljec#l#bhllbh.llllllla.cflfeecddddckneddddddddcilgmdbllllllllkh.l#ej#llbdjal#edddkf.dddddddddd.ddhcdcl",
+"jddacdddddddddddddnbddddjllgemkllcellbc.llllll#deblncdddddcn.bjddddddcddcdklgc.gllllllladjl#dellgdcmll.ddddddddcjddddddddddddddl",
+"mddeaddddedddddddddedddddh#eee.glbkllbi.lllllljekl#cddddddcbcdddddddil#.dddhlbdelllllllbhc##jjlljdeidcddddddddef#ddddddddddegcdl",
+"jdddiddddckddddddddddccdddea#cch#e.llbj.lllllnc.#l.mdddddddddddddeddcjflmdddfljmnllllllb.el#delldeflgdddd.hkmcnllcdddddddddelccl",
+"mdddddddddjddddemcccmfmdddkllbj.#hbllbf.llllljmalacddddddddcddddh.ddddcladddelaee#lllllkg.l#jhgkccllhdddhbcdddd.#cddddddddddlccl",
+"idddddddddddddddn.nn.ddddddlllcded.llbddee.m.del#cjddddddcgcdddjeddmacdhfdd.inl.dcecce.dcjl#ddcddjlgddcfedddddddddddddddddddmdel",
+"iddddddddddddjddmedddddddddnlleddd.llbddkehnddhlkcdddddddfaddddddddml.ddcdddceladmkekdbcdil#ddjddglbddcakcddddddddddddcahdddddcl",
+"hddddddddddddi.dcfdddddddddhllk.ccklln.m.dcmmj#l.eddekk.blcdbbcdddddkbhicddde.f#khhm.bhhb#llkhhkalljddddfaddddddddddddhfcdddddd#",
+"hddddddmdddddegcdcadddddddd.llllailllllll.nlllllecddikkafmddekl.ddddddccdddddcbllllbhlllllllllllllledddddbfdhedddbjddddddddddddl",
+"idddddddddddddddddbcdddddcdcllllaillllllljnllllaeedddddddddddeeeddddddddddddd.hllllhklllllllllllll#cddedddn#hddcnfcddddddddddddl",
+"jdddddddddddddddddddddddchddglllhilllllll.fllllicdddddmaaidddadddddddddddddddd.llll.blllllllllllllnd.cn.dddmddddicddddddddddddcl",
+".ddcddddddddddddddddddddcgddjkbfmj#lllllgdbfg#g.mddddd.knjdddiddddddddddddddddchkkhcejhkafglllll#gkdjedddddddddddddddddddddcecjl",
+"faedddddibddddddddddddddciddddddddddccccddddddddddcddddddddddedddddddddddddddddddddddddddddillnecdddjcddddddddddddddngiddddcalll",
+"l#cdddddcgeddddddddddddddddddddddddddddddddddddhng#acdddddddddddddddddddddddddddddddddddddddgndddddd.cdddddddddddddd#bdddddddgll",
+"lmddddddddddddddddddicddddddddnnddddddcdddddddddcilcddddddddddddddddddddddddddddddddddddcdddddddddddc.dddjnnkdddddddmdddddddddll",
+"fdddddddddddddddddddddddddddddbjfidddddddddddcddcckdddddddddddddddddcmmdddddddddcm.ddddddddddddddddekhddd.becdddddddddddddddddal",
+"bddddddddddddddddddddddddddidddddbaddddddddddcddcc#edddddcacdddddddddcfedddddddddddddddddddddddddddddfdddd.eddddddddddddddddddal",
+"bddddddddddddddbbmddddddddddddddddeiddddddddhddd.mlgdddcddflidddddddddeddd.mddddddddddcedddddhjdddcjegmddddbcdd.ddddddddddddddgl",
+"fddddddddddddddchfcdddddddddddddddddddddddddejddcenhddefha#j#ndddddiddeiddmeddddddddcjhjdddddcjdddcjhamddddhjddkcdddkcdddddddill",
+"l.dddddddcddddddddddddddddddddddmedddddddjecdidddddddcmllgcdd.dddddddddkcddddddddddddddddddckdddddddddddddd.gjdedddd#hddddddd#ll",
+"l#cdddddc#mddddddddddddddddddddddnedddddddejcddddddddnlfdddddddddddddddcjdddddddddddddddddddcdddddddmdddddddcdcjddddf#kddddcalll",
+"ll#hee.klljdddddd.jcdddcce#fccdccgheeecccccdddddddddcecccdccccccceeececdh.dddddddddddddiddddddddccbj.eecddeeccfj.eeenllnbba#llll",
+"lllllllllllgggg#nlll#fglllllll#lllllllllll#ggfffffn#ll#ll#llllllllllllllll#ffgg#gfnggff#ffff#####lllllll##ll#lllllllllllllllllll",
+"l#liiiiihkhhhihiiiijjmjmmjjmm..eeecefl#jmjjjmjijjjm.mmmmjmmmmmjll.ee.....eeeeeeeeeeceecemlfe...eeeeeeeee.ee.eeeeeeeeccccccecelll",
+"ke#kcddddddccededmdcdcdcddcdcd.cdcddjll.dddcmddd.e..cjdjdjdcdd.l#ddc.emcjchdmdhcjcjdjeddilbdddd..djdidickeicmeiccdedidkddddcbl#l",
+"idclbddddd.jmjdidjdcdmccccedmd.edcddclladddd.dddeedddddcdcddddml#ddceejdcdmdmd.dcdcd.cdcllmdddddddcdddddcdddcddddddddddddddall.#",
+"iddmfddcmdhbabbcdddmabababbaaaanaa.dchgacm.agg#g##gg###ggj##cjcaicemggffffffffffffggkc.mniddcg#############ll#ncdm#lllgdcdcflecl",
+"iddddjkc.dhllllmdekjllllllllll#ggghdeddcceckllllllllllll#ciaemchidcjllllllllllllllllhccmmdddblllllllllllllll#idddnlllfc.ckf.mdcl",
+"mcdhd.lbdbdklllhdclamllllllllled..cdddfl#db.lllllllllllllcddde.lld.cllllllllllllllll.i.l#dddlllllllllllllllkddddclllgccdall.ddcl",
+"m.dcm.m#fcejbll#ediidm#llllllljciiebeemllhmc#llllnjllllllhdddemlldcdillllllllllllllncmfladcdma.glllllllllnejagfjmll#cicfllehddcl",
+"mcdj.ecjlb.gckllidddjnj#llllgb.dkgjlcdd#l#cbillgkmlllllljicbdc.l#dcddhlllllllllllll.jell.eddd.ecgfglllllhcbngllablgeidblljeeceel",
+"eid#bdndmladi.nlbddcllgc#ll.ddecadmhdmdnllmcd#bdc#lknllllcdddd.l#ddmdd.lllllllllll#ddhlndcddblfdemmnlll.dddddkli#l.edblljdibimel",
+"mcdllnci.jlne.dafddcllhmmll.djlbaddddddmllachjm#.#mblllllgcac.ml#dchcddcnlllllllllkam#lmm.debj#ciiak##.ddddddd.h#cejnllea.flim.l",
+"ehdlllk..chlkchcb.dcancmkincckm.fcddddacgllmbdalcecfballllkeceml#dchhdddillllllll#ecil#ceddddd.nllhijeddcmbfgn.ie.mkl#jm.bllhdel",
+"mddblllbdfdjlnddckdddd.mbcdcn#k.ddddddcdillac.d.a.cddikbj.ecd.ml#dckl.ddkllllllllam.flieedddddcll#a.ddddhflllljdmdklljdhalllbjel",
+".hdd.bllbcmeklnc.dddddjl.ddehbjddddddbdiell#c.dh#mecccdce.cccjjl#ddejeddcjlllllllmc.l#cdcddddddmebfeddddddchl#ddcnll.minllllbdcl",
+"meddddehnme.cklacdddddhlhdilkdgjdddimgkedflljcecmfeh.dcemkaic.ml#dedj#bcddmlllll#cjalndhcmcddddddmmdddc.d..cmmdmhllijcklllllkj.l",
+"mjdiddi#hddcgdbladcdddcicmellckedddbaklci.ll#midafmhcgllgfkdmkml#dddc#lgcddallllhmclljddfljaedddddddcfll.llhdddhllhcail#ieccddcl",
+".icledblndkjc.eklacdddddi#djmddddddhlhk..dgll.edigmhakllllkcdmml#cmddealkddallllc.jlfdmdjech.cddddigll#m.iic.dblljijdcccddddddcl",
+"m.clbda#cellie.dklkcddddblaemdccddjmnbmecbkllkjdijhcchl#ain#.n.l#dddedcjjddnlllfecgli.dci#nd#idejnlllf.dk#j.jillki.cdddddddke.el",
+"eael#djndjllkddbdblbdeddkllmndklnddgmelbdielllcekllbcl#egl#iddmlgd.i#djlfdcalll.emllcmdhllli.malllln.mladdhcdjlid.cddddcddmfdn.l",
+".dellbd.dellcmc.ddblaeddmllgene.cddcc.lejdehllhj.llhilkhgecd.n.lgddcb.ellndcglfeealhkmdfllllllllnmcddfl#c.cb#jecaddddd.##ichidel",
+"emellledddgadjhdcedbnecicglla.m.dddfbcj.#djellgdealkllkbedcccjmlgc.cnmdi#lcdilhce#lccdmlblllll#imcdddhgj.cillheedddcj.elgbhlhcel",
+"meelllgdddijddmjjdjdd#addclllijidd.llejd.cde#lleh.lllljbdd.f.f.lgddddbdb.hedelmmblf.iel#jllllfe#l.ddddddmkllhd.cddelllm.i#llhdel",
+".kelllladdcmdcke#dcccnla.icnklm#kdalkdg#acde.llgde#llledddfgcemlg.mcd.dagcdmgkcellmmcalhgbg.hdblheddddiekllidmddm.e#hjkgllllbdcl",
+"e..lllllkddddelaemc..calkchdkljln.#l.djlled.dgllemilln.cealf.amlgdcecaeegadk#cdmlfdkdabb#iid.bemalmddjchllkdecb#lgedk#llllllbcel",
+".f.llllll.ddddaljdnjdednlb.c.ginmj..ddd##dh..hllhdd#lll#blllc.mgfdjh.eeddedc.ddnlimdddhlgnedklhbllcdechllhdejlllia.m#lllllllkcml",
+".c.lllllllhdddcl#d#ndcddaladmdhaig##cddjfd#cccll#ccblll#aimedddhjddecjkdbbdkec.llceddd#ncck#bem.jcdeiblli.ckllhcjkjnflllllllbcel",
+"ebmlllllll#cdddnlj.cdd.icnlhdeeekijhddee.d#kjeblljd.bj.cicmddd.lgddddideehdkcdblji.cmdecdblll.#eddjmhllbdijllhciebbj##llllllbj.l",
+"edjlllllla.fecdmlnddddddecnlbccelllleelendf#dd.#kcddcccdce.ihklllgfnhmecccdddd.nddd#bc#hcllllncechdkllkdchllkmmadkjdi.jlllllbjel",
+"mamllllljjkb#fddalcdddddjednlncmef#fejlg.cglmjecagddciag.flllllllllllll#gajcdif.dkelmgljjllll#e.c.nlliehi#gjjb..nglcikmlllllkccl",
+".imllllljegllnddml.ccde.dcnenlkcjc.kkeknnclladdmllka#lllinlllllllllllllllll#b#lmddil#llj#llllgdmmkllkhcjhhbhmed.l..dniklllllbhel",
+".imlllllndgll.ddc#hjgchlc.hednlnddc.ddcdbegacdd.llllllllnbllllllllllllllllllll#cdddklllllllllmjdbllkdeeflllmddd.l.ijeemfflllhdel",
+".k.lllljdmmlbddddjlm##j#hmdmndnlfc.difedcdcdciglllllllllljlllllllllllllllllllll#kcdcenllllll.jcflljd.kfeekmf.ddckiaff.cmhlllkecl",
+"ecmllljcbl..dddddd#aelfjjibd..ealbcd.fhddcddflllllllllll#ennkhiiihbag#lllllllllll#hccchllllidiblladejllajjdlmcdmlnn#dcfmbnllhe.l",
+".h.lll.ilfddddcddd#lbihiealddmadnlndjcfcc.hmflllllllllnjcddddddddddddddjallllllllllnddde#lmedfllhcd.illb#lcai#jd..iemnbhhnllk.el",
+"edcfllmdhlmcddkhcdlllhcgh..f#kdicaladddmegl#eglllllamcdddddddddddddb#gnkccmalllllllaehddcecdflliedca.lljlf.fh.addb#gafkbcll#.del",
+".ddd.jdieicddelbcalll#hcjagllli.ccaf.cdmglllgmllla.ddddddddddddddddfllll.dddeb#lll#cnlaccddjllkd.jnb.#bnlinllccddina#nfje#keddcl",
+"bmdmeddmmddccdec#llllnedjllllllhdgcd#nmllllllb.gcddddddddddddddddddiflllcdddddchllmflllgedjdghddhl#ccddmhkllbdddddddi.dddddmmd.#",
+"ll#kcccjdddddhg.lllllladikllllllkecdnllllllllgcddddddddddddddddddddaakjedddddddd.jjllllllflgcechgkfehddddebfhf.ddddigedcidcek#ll",
+"g#ll.bm.d.dcdig.flll##me.cnllllllmddmlllllllncddddddddddddddddddddc#llldddddddddddillllllllhdcj#.jcjledddcccifkcddde.dhcjmebllll",
+"edi#jll#kdcndddd.llad.khgddalllllecd#llllllhdddddddddddddddddddddddcmkadddddddddddd.#lllllliddbdddegh#hd.##iljibdddd#cch#lkbllll",
+"eddccblll#amcd.cd.a#habcadejhlll.mjfllllllmddddddddddddddddddddddde#gn.dddddddddddddefllllll.ddd.nlnilnilliji..c.dmdjb#lllkhgjel",
+".ddjc.chglllnmecddd.fh#dcedgfllbkebllllllmdddddddddddddddddddddddd.lll.ddddddddddddddc#lllll#eddkggmlli#lgcg.deemejnllllllhcddcl",
+"eidbedddd.nllllkcdm.dchdelg.glndcillllllmddddddddddddddddddddddddddcjiddddddddddddddddd#lllllnddcmdbl.c.j.dd.jdchlllllllbcdacdel",
+".cmllgkeicdehgll#fmc.c.ddkllll.bcefllllmddddddddddddddddddddddddddm#g.ddddddddddddddddd.lllllljdel#hjf#bdddmcjf#lllllnmcideec.cl",
+"ejmllll#becdeciflllgjemd.chglaccnbeklladdddddddddddddddddddddddddddikcdddddddddddddddddd.lll#h.cdhll#becmdchflllll#b.dhdm.k#ik.#",
+"e..lllllll#hdcgcckllllaedcedcdkmlllj.addddddddddddddddddddddddddddilbddddddddddddddddddddblgdklfecnjdd.deallllll#mcckjdi#lllkdel",
+".mjlllllllll#bjdcdmjnlllficjmdc#llllkdddddddddddddddddddddddddddddkljddddddddddddddddddddd.mgllljddcheiflllll#k.cicedcflllllhdel",
+".hmllllllllllllfjeid..bgllgccdklllllhdddddddddddddddddddddddddddddb#ddddddddddddddddddddddclllllnddchllllllficdmceddhn.#llllkmcl",
+"mdjllllllllllllllln.jmidmgnhln#llll#cdddddddddddddddddddddddddddddafdddddddddddddddddddddddblllllbf.llll#hdd.cdddjkhmncbllllhdcl",
+".hmlllllllllllllllllf.ede..iglllllljddddddddddddddddddddddddddddddajdddddddddddddddddddddddclllllllkhlamjjmdmbnjgkiadeic#lllkmcl",
+".djlllllllllllllll#nkcfmdjhd.lllllgddddddddddddddddddddddddddddddd.dddddddddddddddddddddddddallllllad.dmmmmfllkng#hdcjlenlllkdcl",
+"..mllllllllllllljfcdddcddddcilllllicddddddddddddddddddddddddddddddddddddddddddddddddddddddddcllllljddidcnlllllkim.dd#.lkalllbdcl",
+"mcjllllllllllliedddemddcc.denllll#cddddddddddddddddddddddddddddddddddddddddddddddddddddddddddallllhddiflllllllljlnjd#hfgglllhjd#",
+"mcjllllllllllbdddckgbma#jmdelllllkdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddjllll#cegllllllllgjbnkcng#lllllhec#",
+".h.lllllllllcdddcllle#lkjmdhlllll.dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddc#lllljnillllllllllabidnlllllllkam#",
+".cjllllllliedd.bkllhcmeddciflllllcbgidddddddddddddddddddddddddddddddddddddddddddddddddddddddddbllllic.llgemijinlgmjjllllflllkecl",
+"eijlllllliddd.lmmh.dcdmfjdcgllllad#lkkfccdddddddddddddddddddddddddddddddddddddddddddddddddddddjlll#hed#llm.ngljg#cijllaem#hlh.cl",
+"mdjlllllgdd.c#jdedbiheehib.lllllmellmglmlfcdddddddddddddddddddddddddddddddddddddddddddddddddddcbmecmdcfll.ddclfk#.hjlgddb.#lhkcl",
+".emlllnjeinleed.#bm.bmnjceelllllejllml#hlghfc.dddddddddddddddddddddddddddddddddddddddddddddddddbf#l#ceall.ddciligih.ljddmdllh.cl",
+".ccaabddiggmkddjjckjjejbii.llll#dkllilanlkafhlficddddddddddddddddddddddddddddddddddddddddddddddlllllekklfhccbclnehbmkmci.c#lhiel",
+".ddckddcidddddcddddddddcddmllll#deij.ama#cfkgllllgjddddddddddddddddddddddddddddddddddddddddddddgllll.ccj.ccdmdjjcc.ededd.dihcddl",
+"edccccdckdmdjdkd.dhen.kmedillllfddddddddcdccc...mjicdddddddddddddddddddddddddddddddddddddddddddnlllljceachdnekcncf.bckmiecdmddc#",
+"#f#gefffanaabbbbkkhhiiijeinllllfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddallllaccicec.ccc.cmcmc.ej.cdjddc#",
+"lllljllllllllllllllllllfillllllndddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbllllllhkllllllllllllll#llll.gfgl",
+"lllljllllllllllllllllllnkllllllndddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddkllll##hhllllllllllllllllllljllll",
+"jmmjcjikbkbbbabbbkkkhhk.eibllllndddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbllllfccc.mmjiiijbaaanfgg#g#.f#fl",
+".dddjdadcdndbebcmcaeijbiedellllfdddddddddddddddddddddddddddddddddddddddddddddibhbimdddccdddddddallllfdd.d.d.ckdbdncndkdidbdjddd#",
+".ddmmdecddcd.e.dmjemcdjjccellllgddddddddddddddddddddddddddddddddddddddddddddddmallgcac#fc#k.fadnllllncdmcjeddddddc.md.djcjdhcdd#",
+".dclldjeddecmbjdfleace#lmidllllgddddddddddddddddddddddddddddddddddddddddddddddddeki.aelfelbhl#d#llllb.dhejececdddelgcdcf#ffam.c#",
+"mdclndcddehl.hdamlbddcelkdd#ll#kddddddddddddddddddddddddddddddddddddddddddddddddddddcjlkjliflfclllllkcchjkibddd.ikaddcllllllkn.l",
+".ddkjf.h.#llmddgkfljddmlbjd.mmihcddddddddddddddddddddddddddddddddddddddddddddddddddddd.chlmllkclllll.cdicmddddhlneeddhllllllkjcl",
+".ccglk#fllll.ed##.ggnchlfdch#lllidddddddddddddddddddddddddddddddddddddddddddddddddddddddcielljmllll#ceddecdife#ndddde#llllllhael",
+"eiclllllllll.dd#l#mmmeel#.nkllllgdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddichllllgddcglf.llelecdjbllllllllijc#",
+".d.lllllllllec.#llllll#lljc.lllllcddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddglllladdk#.cbfidmddjlllllllllligjl",
+".celllllllghddcheilllllllki.#llll.dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddelllllhddhcddddddddc#llllllllllh.cl",
+".dmllllll#jndemfed.llllllfddalllladddddddddddddddddddddddddddddddddddddddddddddddddddddddddddhllllledmdedddddj.j#lllllllllllkajl",
+"ec.llllhllebdecjcajkllllamddjllll#eddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgllllfddccfkcd.alllllllllllllllk.c#",
+"ec.llllmflidcmmjk#lgl#aedcdcklllllkdddddddddddddddddddddddddddddddddddddddddddddddddddddddddmlllllacdbdcianlllllllllllllllllkfj#",
+"edellllndkjeg.ll.llfjdddd.dfllllll#dddddddddddddddddddddddddkddddddddddddddddddddddddddddddd#llllllfdedmdecnllllllllllllllllkdd#",
+"edellllldikj#femja.dddehflajnblllllhdddddddddddddddddddddddcndddddddddddddddddddddddddddddd.lllllgljblnjcicieh#lllllllllllllkae#",
+".d.llllljglb.hddcc.eeblllladdd#llll#cddddddddddddddddddddddbnddddddddddddddddddddddddddddddfllllfdie#lll#jeaehch#lllllllllllkcc#",
+"ecellllllmjmddddccigllllhddhddkllllledddddddddddddddddddddcladddddddddddddddddddddddddddddillllljdd.calllllnmedfdealllllllllki.l",
+"ec.llllllf.dded.kglllfiedidm.c.#llnmn.dddddddddddddddddddd.lkddddddddddddddddddddddddddddc.flllfcdcide.h#llllnjmcgemb#llllllhccl",
+"...llllnjdddceblllln.edbccklgddilimllfddddddddddddddddddddcnjddddddddddddddddddddddddddddff.allckcghek.jchgllll#ij.#cehgllllhhcl",
+"edclgjddddck#llllhc.dbdddmfn#ndddnllllndddddddddddddddddddfaedddddddddddddddddddddddddddilllj.kddalllncmmjd.flllllaeclei.nllkdcl",
+".dd.cddd.bglllfieecjddchjd.dckcdcllllllidddddddddddddddddcknmddddddddddddddddddddddddddilllllidbjllf##.dce.cc.alllllaicnjj.hmnel",
+"eddddcmnllllnmdjced.idblbhn.kcd.mblllllliddddddddddddddddkbmcddddddddddddddddddddddddd.lllllljidnllhdccmjaddmce.alllll#jcnejcmcl",
+"eddcc#lll#hddhedmakhdal#mgclgcdddcnlllllliddddddddddddddd#llmddddddddddddddddddddddddmllllllid.hll#lndb#df.#bccmbdm#lllllac..ddl",
+"jjb#.llnicecceifla.ec..cmjg#.j..mmcgllllllhddddddddddddddhafedddddddddddddddddddddddj#llllladi.lllamicjlch.al#kd.midjnllllfejddl",
+"llll.b.dccmddm##adcbgddddcfidghkfddc#llllllbddddddddddddbfhjdddddddddddddddddddddddhllllll#dddgllllg.dcacg#m#llejecdddenllljlnjl",
+"llljdddddddddddefdall.dddddddjl#dbdi#llllll#dedddddddddclllleddddddddddddddddddddcfllllllll.d.mllllllacndhllllljbladdddceifmllll",
+"hmcdddehgedddddblmmlgekcfjciclg.cecnfjkllllkb#kcddddddd.hihkcdddddddddddddddddddeklllllll#l#dhdhllllllhjhillllkdbjddddd.heccalll",
+"eddddck#lmddddd.hee.cffb#ikfcb.ceifddddallf.lllgmddddddnllgkdddddddddddddddddd.n#.llllllj.#ma..ehlllll#cdenllb.igcdddcdddmihechl",
+"eddkdggid..hccdddbl.d#mlaagbjdi.algdmddcmlmflllll#icddcflll#ddddddddddddddddj#lllnelll#edcdilljcejllnimjkjlllc#jjddddkkdcfjcdddg",
+"edcidg#ae##ledddclfcdmdghgl.endhlgedei.jdejllllllllgbedceibkddddddddddddd.bgllllllhhlncjcdjmll#.jcijcnjnm.jlleiddddddflic#lgmdd#",
+"e.egj.cdckk.edddcg.ddddm.##cc.kl#eddbll.cmdkllllllllllnh.cccddddddddddmkglllllllll#dmddc#ijdhlll.kcde#adc#bnlndddddcc#g.cfllbdd#",
+"e..lllmillnc#cddcajnddddcnde.blgdm.blllladcdcnlllllllllllll#fannnngg#mllllllllllllndddddmlbcmjll#mcedce#m#lmnljddd.lkcehhlllbkcg",
+"ee.lllihl#jfjmndjlincfiddccdklfe.dbllllllf.cbcjllllllllllllllllllllllmllllllllllnjdddeddkhlkdjjll#.mchj#ghg#jll.ddil#c.allllbhdg",
+"ei.ll#i.ne.mmi#e.lkkml#cdddkl#e.dhlllllfbllkdddfllllllllllllllllllllliflllllllgmddche#kcdn#licdhll#eicc.lidhd#lnddnlliblllllb.dg",
+".cmlllih..lljidhdgmdddcdmcblgcc.dblllllcfln#ejcll#ealllllllllllllllllkilllnhflfcdil#c#lmdcfgic.djll#ek.d.cdcdjllfc#lgcelllllkhd#",
+"ekalllllkdng.jil..manhd.dklfeheddj#lllidfmjf.icmabddeiaglllllllllllllheai.dd.lgddjljhjlbdemibiecdmll#ecddddcdclllhmiceflllllbjc#",
+"ed.lllllkcedd.llmd#lbdcdkllchdcciimllgddcdnhcdffedddddcdcmiannglfijm.dcdd.ddcbee.c#effkbdffb.hlmcdhllled.dddddflllcdefllllllbic#",
+"eamllllll.db.#ljdnlfddcalncedmmckmc#acd.cdbdaillnddddddddd.eddkljddbdcddcibmfj#lddjlenndcdig#fhddc.ill#efddjbnelllhdblllllllbmd#",
+"eemlllll#eh#if.djlfeccklgeccdjajhfbcckilnddhcalliiddmfedcdddddhf.ccihbn##llmmc#lkdc#mkmdddjihicdde.dill#chdnl#dallnddallllllbmcg",
+"encllllfcclkdddm#fcedkl#e.edclljm#gdc.fgjdcfc#lleeddclnddmccmjcmcfillllllllbhenlled.alliddflll#dm#cddbll#e.cj.mmll#cdc#lllllk.df",
+"ej.lllfml.jmfedccdcdklgcmcddcmmgnm.cddedfae.bllaimdddl#cdiccdcali.mlllbm#lll..mllhddhlllkdeklladngbhmchllbdccch.klliddclllllbjdf",
+"ecmllle.jjgllmddddce#g.ecdcdddflamnbnb#hlj.j#llecdddkmjddij..iblh.m#ejc.klllahcglgddcjfl#cgbjedc##hadc.h#maccdfkealndddjllllbmdn",
+"ej.llimfl.h#ndddcdjmccdccdddd.fmklllllim.di.llgdejddkl.d.mecddalihm#ddcbjlll#cimll.d.idjnalllh.gll.gcic.caladjcibjhfcdddklllbhdf",
+"cd.n.f.flidddddddklfdddklidddcbllllll#kgdcdnllkb.led.lndd#m.kialic.gcdcahllllmmcllfddkbdmm#llh#lnjdfbgj.dkllfce.cl#kdcdacallaicf",
+"cid.gfcc.cddddcdklgejcchlnddi#l#fanlllladk.lllcmblgccnfcdj.d.ealiec.cdjlilljbgjknllccilainiblmkjknnhlgjcaekllf.hdbllcdml.c#lb.cf",
+"eddc.dddcddcccdhlleedem.kbcfl#keddd.llleddblla.iglfccccddbndbinlhkee.ilfhlhellm..llkdell#nlj.calfikmllihm.efllnendnld.lljdmlkcdf",
+"eedddddddihd.cblgcccebcedjlgmddddigcekcdddgllmcelllccfl#mdecccalhe.llla.#gddn#bi.nll.jalgg#cdcmdclnejlaelhdcbllnc..mc#llkddakfdg",
+"eddccejbfaebckl#.dedmkfncijdddddd.lfc..mb.lllebnllliddflle.ejjnlijml#hkllbhejimcmilli.e#aakddddddnlih#gdk#ijcbllahicmf#ljddjaedg",
+"ejel#lllgdceblleecddkhmdddddddddd.#hblnccfllieelllllmdhlljddecalimc.d.ffkenhblbdl.#lfedbeddcdcdcdeli#n#ddfl.hmnllhe#cc.mddcc.gcf",
+"edmllllbcccbl#cecj.ddddddddn#hedddddmjdhell#djhllllllfcalhcdi.alh.egfnnaankkcl.cccjlljkdddddddd.cddblmaddcglhcjk#lacg.#l#n.ddccg",
+"ej.lllbcmeblg.idjllfidddddcnll#.ddddddecilla..gllllllledmjjdmmalhhchkkhkbbahcbkfdjcllfe.ddddddchgkem#accdd.llijdmllamjiglllnendg",
+"edmlladidflledcdemmmcddddhd.llladdddcdiegllj.illllllll.dml#ckhalidcahjj.mmmjdd#hdejfllc.dccdbfjbm#ahe#ilmddnll.ddfllbmie#lllbcdg",
+"eedlhcccnl#cdcd.ddddddddalmhjlkeeceddcejllnmbnllllllllncdjlmmmalib.mlllll#enbd.jbcjellkimcddc#blheblb.ellcddnllji.blladfe#llbadf",
+"cedjddealgmdemelnheddddbllgi.jcjl##cdcmnllhec#lllllllllghefjjjnlhmebhllllf#aehc#ge.efll.cdcecjhlgdinkgjbaddchll#hejbllbeh.glamdg",
+"ecddddfllcidkfhllllmddbllllfble.lgjeddd#llciillllllllllllfcei.alicdajklllla.flekege.illhnc#lkdcl#c.eecm.cddd.llll.bcfllbjjcgbgcg",
+"cddccglgc.dklkd..ccddgllllllllmdeededdhllbjj#llllllllllllledmenlhicacmebll#lle.hflkmc#lgc.klefckjcnahfgc#l#cdjlllljkcbllncfcecd#",
+"cdddjlgeechll.dddddmglllllllll#if#jdjc#ll.emllllllllllllllfcmmnlhecjcjaalllghnllll#dhjllijehk#cbnballllhlllcdelllllje.allaeb.idg",
+"eddkefcdehllgdddddilllllllllllllll#dc.llgdjklllllllllllllllmmenlhecfdmjbllllllllllle.cggkcjdknchjilllll#blkdddfllllljjcfllajcdc#",
+"ee#lndddklllmdddj#llllllllllllllllhccc..ccc#lllllllllllllllmbbhfmfckii.alllllllllllfib.nbcccb.mlllllllllbcddddc#llllljbckllhdddl",
+"bglneacilllncdcalllllllllllllllll#ejeffackjllllllllllllllll....iecclll#nllllllllllll..ellbj.hn#llllllllllacddddflllll#ciekfmkddl",
+"lllcdddce.edddd.m.mjjjjjiiijjiijm.dekllkdddemmmjmmmm..mmm..cdcaliedhbbkabbkbbbbbbbbhccdnll.dc.m...mm.m.emmcdddce.eeeeedcdddflicl",
+"lncdddd.dddcdccdedcddddkejdmm.bincddgll.ddcach.ikbbhicnjfmbeddalhddjmjn.icacndacndhdiddillkddcheacncndnef.neb.gjh.hkhb.gcddhllll",
+"lajjjmmjjjjjmmj...m..mmmm...mmmjjm.jlll.ecc.c.e.mmecee.e..meeeblhddeeejc.cmcmdmdedcdedddglfe..m.mmjjmmjjj.jijiiiijiijijijmjjglll",
+"lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllfnnnnnfffffffffffgffgfnllllllllllllllllllllllllllllllllllllllll",
+"llllllllllfiiijkkhj.e.mjjighe.ee.ceceeee.m.e.ee.e.mme..eeeeccccceeeeeeeeeee..ee.llllllllke.mjm...mjjm..eeeccccec.hceeglfjeekllll",
+"lllk.dcjalmdddddddddddddddhcddddcecdddddddddddecdcbcdddcdddddcdddddddd..cdddddddmbi..iafddbllll#llllf.ddddddd.cdckdddnbddddd.#ll",
+"ll.ddddddmmddddc.cddddddddedddddiddddddddddddngn.dgjdda#cdddddddddddddgllmncdddddddddddddde..m.m.j#mddmddedddehehhdddjddddjddell",
+"lhdddddddddddddcb.ddddddddbdddddcdddddddddcdjkddaddfcf.cmc.lfhdddddcddajcdjcdddddcng#feddddddddccedddcjdbjdddde.l.ddddddddddddhl",
+"gdddddddddddddddddddddddddfeddddj.ddddcddddddddckddik#cd.e.ammdddddjddddddeddddddmhdnjnedciddcmdddddddd.nceddddclahdddddddddddml",
+"hddddddddddddddddddegcbdddekddd.addddcajdddddddcmdddfhddddejdddddddccdddddddddddddddbddcdcedcddddddddddcdhedddddae.dddddddddddcl",
+"iddddddddddddddbddddmdeddddccdikdddddehmdddddddccddd.dc.dd.lakdddddd.ddddddddddddddcbdddddcfccjicddddddcbmddbkddj.ddddddddddddcl",
+"nddddddddddddddmdddddmdddddddeiddcddddcb...ddddjmiddddchdd.bijddddddneddddc.c.ddddeahddddddmbghd.jddcddccjmahddddcdddkddddddddjl",
+"l.dddddddddddddddddddddddddddcddddddddddjicenddiieddddcbddm.ddddddddjedddddcikddddddddddddddfcdalmdeadddddnidddddddddf.ddddddc#l",
+"lfdddddddhjdddddddddddcngj.ddddedddddddddddccdddcdddddcaddjeddddddddddddddddddddddddddddgjdddd.bmedddddddddddddddddddf#edddde#ll",
+"lgjddddddhccccee..mmminllllfhjnlfmmmjeddd.cdedddd..mmjhl#gl#gnkdddhffffnijmjihi.edddddddjbcmiijji#ahbkkkkbbbkhjjmjmmcdcddddddehl",
+".dddddddddc#lllllllllllllllllllllllllbddclkcldid.lllllllllllllmdddmllllllllllllllcddddddedhlllllllllllllllllllllllllidddddddddjl",
+"eddmddddddellllllllllllllllllllllllllkdddbgei.hd.llllllllllllidddddmlllllllllllledddddddcdkllllllllllllllllllllllllljdddddddddil",
+"edd.ddddddellllllllllllllllllllllllllkdccddddmkdmlllllllllllidddddddhlllllllllllddddddddddbllllllllllllllllllllllllliddeddddddbl",
+".dddddddddellllllllllllllllllllllllllmd.gmdcdkndhllllllllll.dddddddddklllllllllidddddddddeglllllllllllllllllllllllllhddgeddeedhl",
+".ddddddddd.lllllllllllllllllllllllll#dddccdcddcdbllllllll#mdddddddd.jd.llllllll.dddddddddcillllllllllllllllllllllllljddgfkcaadjl",
+"mddddde.dd.lllllllllllllllllllllllllbdddcdddddddgllllllllmdcdcddejalhddglllllllhddddddddddc#lllllllllllllllllllllllljddackllbdml",
+"mdddddcedd.lllllllllllllllllllllllllhdddcdddddddgllllllledddddddiaheddcgllllllladddddddddddblllllllllllllllllllllllljddhddhfcdml",
+".dddcmcdddelllllllllllllllllllllllll.ddd.ddddddd#llllllmdddddn.dddddddellllllllgdddddddddddillllllllllllllllllllllllmddbcddddd.l",
+"edddc#kcddelllllllllllllllllllllllllcdddcddddddjlllllljddddddgmdddddddckm.alllllcddddddcdccellllllllllllllllllllllll.ddkcdcdddml",
+"eddddicdddcllllllllllllllllllllllllkdddddddddddglllllmdddddddadddddddddddddbllllmdddcdchdejdlllllllllllllllllllllllljdd.ddddddjl",
+"edddddedddcllllllllllllllllllllllllcddddddddjdelllllmddddddddedddddcddddddddklllfddddddmddkdblllllllllllllllllllllllmdddddddddil",
+".dddddddddc#llllllllllllllllllllllfddddddddcjdillllmdddddddddddddddddddddddddfllledddddimdadcllllllllllllllllllllllljdddddddddhl",
+"menanijjedcgllllllllllllllllllllllmdddddddddddflll#cdddcddddddddddddddddddddddnllidddddindkddbllllllllllllllllllllllidddddddddbl",
+"mmbeeedccddklllllllllllllllllllllkdddddj##iddell#.h.dd.bdddfjdddddddddddddddddcnllcdddjm.dcddc#lllllllllllllllllllllidmb.kcdddnl",
+"jmmcdddddddbllllllllllllllllllllgcddddcbcjfaebl#mdddddeadddcdddddddejdddddddddddfladdjmeddddddilllllllllllllllllllllbdc#jlcdcall",
+".jmddddddddblllllllllllllllllll#cddddd.cdddefllcdddddddfddddddddddda#ddddddddddddfldd.ddddddddd#llllllllllllllllllllhddac#dddfll",
+".hcdddeddddhlllllllllllllllllll.ddddddddddddb#mddddddddkbdddddddddi#kidddddddddddiladdeddddddddcnlllllllllllllllllllbddedidddcbl",
+"jhdddeedddcglllllllllllllllllljddddddddddddel.dddddddddblhcddddddcn.djeddddddddddg#g.ddddddddcddmlllllllllllllllllllbddddddddd.l",
+"imdddkddddilllllllllllllllllljdddddddddddddheddddddddd.#j#lhcddddmcdddddddddcddddddddddddddddddddklllllllllllllllllladddddddddel",
+"idddcbddddcllllllllllllllllljdddckiddddddddcddddddddddhndcancdddddddddddddddfjddddddddddddddddddddnlllllllllllllllll#ecddddddd.l",
+"hddddcdddddallllllllllllll#.dddddcncdddhddddddddddddddbkddfdddddddddddddddd.gddddddddddddddddcmcdddbllllllllllllllll#.ddddddddel",
+"kddddddddddflllllllllllllgddddddddbddddiddddddddddddddbmd.addddddddddddddddj.ddddddddddddddddekdddddalllllllllllllllkdddddddkdel",
+"amjhkkkbbieallllllllllllhcdddddddmbdddedcbdddddc.cddddk.djjddddddddddddddddddddddddddddddddddecddddch.blllllllllllllkdcdddddcdel",
+"amka##lahk.kllllllllllf.dddddddddbh.jiddmgddddj#l#mdddh.d..ddddddddddddddddddddddddddddddddddcembddddddekgllllllllllhddiedddddcl",
+"nddjkda.dddbllllllllljdddcddmiddddmjddddd.dddmllllljddm.de.ddddddddddddddddddddddddddddddddd.gmehdddddddddefllllllllhddfkdddddcl",
+"nddedddcdddhllgnfnj.edddddenfhdcdddddddddddddalllllgddddddeddddddddddddddddddddddddddddddiabmcddcdddddddddddcma#llllkdddddddddel",
+"fdddcdddddddccddddddcdddd.fmckdddddddddddddddflllllledddddddddddddddddddddddddddddcddddd.#mddddddddddddcdddddddddmhkedddddddddel",
+"nddddddddddddddddddcccddddddeadddddddddddddddhlllllleddddddddddmddddddddddddddddddhdddddbcdddddddddedkllbdddddddddddddddbfglllll",
+"ndddddddddddcdddddddddddddcbngcddddddddddddddc#lllladddddddddddbdddddddddddddddmddimddddaddekdddjddkiacenmddd.iddddddddda#eeecml",
+"nddddddddddddddddddcmdddddcmdkmdddddddddddddedilllg.ddddddddddcgdddddddddddddddndd.l.dddeddj.ddddddhlcddddd.nf.dddddddddckbcddel",
+"fdddddemddddddddddddddddddddddadddddddddddcnlmdeecddddddddddddel.ddddddddddcddc#ddcl#edddddddddddddd.jddddd#mdddddddddddddigdd.l",
+"ndddddddddddddddddddddhcddddddmcdddddddddd.llkddddddddddddddddelidddddddddddddc#.efamddddddddddddddddddddddddddcmdddddddcddbidel",
+"fddi.ddddddddddddddddegmdddcmacdddddddddddcfl.ddddddddddddddddmlbddddddddddddddgffiddddddddddddddddddddddddddddjkdddddddbmdjgdel",
+"ledddddddcdddddddddddjcdddc##ddddddddddddcddddddddddddddddddddjladdddddddddddddhncdddddddddddddddddjjddacddddddceddddddddddmgdel",
+"lkddddmddddddddddcdddddchfl#.dddddddddddkgddddddddddddddddddddilfdddddddddddddddddddddddddddmjdddddcffalcddddddddmhjdddjdddmnd.l",
+"#dddddhdddddddjdefedcei#lllhdddddddddddd.mddddddcdddddddddddddhlgdddddeaddddddddddddddddddddbiddddddc#llgiecdddddeibeddnmddn.del",
+"ljddddddddddcilmnlf#lllllll#.dddddddddddddddddddnjddddddddddddkl#dddddcledddddddddddddddddddnnddddddddglllllficcdddddddd#inbddcl",
+"laddcmdddddhlllllllllllllkc.aeddddddddcddddddddde#bdddddddddddkl#dddddclmddddddddddddddddddda#ddddddddmlllllllll#fnkmddd.bjddd.l",
+"gdddkddddddklllllllllllljdddeiddddddddc.dddddddddmlkdddddddde.nlleddddclmdddchhdddddddddddddhlidddddddd.#llllllllllladdddcebnd.l",
+"fdddjddddddklllllllllll.dddddddddddddddicdddddddddnlfddddci#llllllgkcdml.dd.##cdddddddddddddelleddddddddclllllllllllnddde#lllccl",
+"gdddjidddddblllllllll#jddddddddddddddde.ddddddddddc#lg.ca#lllllllllllnffdca##edddddddddddicddabdddddddddd.#llllllllladddddehmdel",
+"#dcddhcddddallllllll#.ddddddddddddddddbddddddddddddjllfflllllllllllllllgmflljcddddddddddel.dddddddddddddddelllllllllbdci.cieddcl",
+"#dddddaddddhlllllll#dddddddddddddddddmddddddddddddddhllllllllllllllllllllllhdddddddddddd.icdddddddddddddddde#llllllladddddddddd#",
+"#hkkecfkdddkllllll#.dddddddddddddddddbddddedddddddddelllllllllllllllllllllkcddddieddddddddddddddddddddcddddde#lllllladdddddddddg",
+"#.eecddddddallllll.ddddddddddddddddddedcddmdddddddddhllllllllllllllllllll#cddddc#iddddddddddddddddddddhmddddif#lllllfcddddecddd#",
+"nddddddddddnlllllmcdcdddddddddddddddddddddcddddddddclllllllllllllllllllllladdddddd.edddddd..dddddddddedc.ddkhdcglllllfdddcl#hdd#",
+"ndddddddcddflll##fdddddddddddddddddddddddddddddddddblllllllllllllllllllllllmddddddbcddddddcdddddddddddddeiihdddegllllbddddamcddl",
+"gddddddddddfll#e.ndddddddddddddddddddddddddddddddddgllllllllllllllllllllllladddddddddddddddddddddddddddddigdddddelllkddddc.addc#",
+"#cdddddddddflndcddddddddddddddddddddddddddddddddddd#lllllllllllllllllllllll#cdddddddddddddddddddddddddnddacdddddde#lbdcdilgldddg",
+"lcdaedeicddfbcdddddddddddddddddddddddddddddddddcejbllllllllllllllllllllllllledddddddddddddddddddddddddnddidddddddd.#hcndn..edddl",
+"#ddedddedddmdddddddddddddddddddddddddddddde.iaf#llllllllllllllllllllllllllllkecccdddddddddddddddddddddkddddddddddddeec.cmdddddbl",
+"#cdd.dddddddddddddddddddddddddddddddddddcklllllllllllllllllllllllllllllllllllllllgniedddddddddddddddddddddddddddddddddddddmacdml",
+"#cddcdmmdddajddddddddddddddddddcddddddddddccc.mihkblllllllllllllllllllllllllll#g#akmcddddddddddddddddddddddddddddddddddijdelmdel",
+"lmdddddkdddnlmddddddddddddddddhiddddddddddddddddddd#llllllllllllllllllllllllkedddddddddddddddddddddddddddddddddddddheddnfddnedel",
+"nddddddceddnlljddddddddcddddddgiddddddddddddddddddd#llllllllllllllllllllllllcdedddddddddddddcdddddddddddddddddddddhledddn.diedel",
+"bddddddddddflll.ddddddccdddddd#ndddddddddddddddddddnlllllllllllllllllllllllfdddddddddddddddeleddcddddddddddddddddkllbcddceddddcl",
+"kdddddddddc#lll#edddddidddddddll.ddddddddddddddddddilllllllllllllllllllllllidddddddddddddddc.dddhbjdddddddddddddjllllkddddddddcl",
+"hddddddddddgllll#cdddaiddddddd#l#cddddddddddddddddddbllllllllllllllllllllllcdddddddddddddddddddddcbddddddddddddkllllnddddddddddg",
+"hddddcde.dc#lllll#.dibddddddddhlleddddddddceddddddddc#llllllllllllllllllllmddddddddddddddddddddddcedddddddddehblllllhdeacdddced#",
+"hddddcd.hdc#llllll#aledddddddddagcddddddcb#l#bcddddddmllllllllllllllllllladdddddddddddddddddddddd.cddddddddddglllllljdmlhdddc.dl",
+"hdddcdddddclllllllllmddddddddddddddddddddccenlfdddddclllllllllllllllllllliddddddddddddddddddddddehddddddddddillllllljddccddddmd#",
+"bdddi.ddddd#llllllllgcdddddddddddddddddddddddb#dddddjllglllllllllllllllll#ddddddddddcdddddddeddcedcedddddddkllllllllidddddddcidg",
+"hddddccdddd#lllllllllncddddddddddddddddddddddc#dddde#lnccallllllllllllafllkdddddddddmdddddddeddddddecdddddmlllllllllbdddddccmkd#",
+"iddddeedddd#llllllllll#cddddddddddddddddddddddaddddflnddddbf#lllllllhcddbllmddddddddddddddddmdddddddjdddchllllllllllidddddj#lid#",
+"idddd.fmeiallllllllllll#edcdddddddddddddddddddcdddhladddd.gddelll..cddddcklfdddddddddddddddddddddddddmdcglllllllllllcdddcdddmjd#",
+"iddddccdddclllllllllllllfcdddddddddddddddddddddddelbdddddbndddglgdddddddddhlhddddddddddddddddddddddddkimlllllllllllleddddddd.icl",
+"iddddmddddd#lllllllllllllgddddddddddd.dddddddddddbhdddddd#jdddalfdddddddddd.fddddddddcddddddddddddddddglllllllllllll.dddmddd.id#",
+"jddd.cdddddchaa#llllllllllfeddccddddd.fjcdddddddmkddddddifcdddklbdddddddddddcmdddddd.cdddddddddddddddallllllllllllll.dddkdddc.d#",
+"mdddddddddddddddc.ag#llllllljcncddddddcgfieeedddddddcjm.#kddddklidddddddddddddddddddcdddddddddddddddhlllllllllllllll.e..ndddddcl",
+"iddddcdddddddddddddddeifllllll.ddddddddddmb#gcddddddekgllleddd.l.ddddddddddddddddddddddecddddddddddnllllllllllnhjmc.#lll#dddddd#",
+".dddddcd.cdddcfcddddddddciflll.ddddddddddddddddddddddddbl#kddde#cddddddddddddddddddddddbeddddddd..fllllll#ajedddddddceceeddddcml",
+".dddmdde#eddddcjddddddddddd.nlkdddddddddddddddddddddccc#bcidddc#cddddddddddddddddddddddiddddddddnlllll#amcddddddddddddddddddefg#",
+"jdddccdddddddddddddddddddddddcgndddddddddddddddddddmgmll.ddddddaddddddddddddddddddddddneddddddddalllacdddddddd.njdddddddcmdddddf",
+"bimm.ecddddddcddddddddddddddcddmcdddddddddcddddddddmbdcb#cdddddcdddddmaddddddddddddddc.ddddddddi#fjedddecdddefhedddddddddedi.ddn",
+"fll#llkddddddddddddddddddddcfddddddddddddjfcdddddddejdddkjdddddddddddalicdddddddddddejdddddddddf.dddddhiddddm#ccddddd.iddcdddddb",
+"jjkcddddddddddddddddddddddd.adddddddddddbljddddddddddddddddddddddddddnllidddddddddddeddddddddddddddddddddddddl#jddddd.idjfddddda",
+"icncddddddddddddddddddddhedccddddddddddd.ncddddddddddddddddddddddddddd.hcddddddddddddddddddddddddddidddddddddmedddddd.kdddddccda",
+"hddjddddddddddddddddddddniddddddddb.ddddddddddciddddddddddddddddddddddddddddddddddcdddddddddddddddmbddddddjcdcddddddddcddddcacdf",
+"kddcddddddd.m.dddddddddddcdddddddd.lmdddddddddkfdddddddddddddddddddddddddddddddddddddddddddddddddddddddddil.daedddddddddckg#cddg",
+"hddddddmhkflll#gnbjedddddddddddddmd..dddddddddkkddddddddddddddddddddddddddddddddddddddddddddddddddddddddmgacdcdb.mjjcddde#nedddg",
+"bddddddddd.lllllllllbeddddd.dddddjddddddddddddkmdddddddcdddddddddddddddddddddddddddddddddddddjmiddddddddecddcjallllledddddcdddda",
+"hdddddadddelllllllllll#hcddcddddddddddddddddddi.ddddddel.ddddddddddddddddddddddddddddddddddddcckhddddddddck#lllllllleddddddddddb",
+"hddmingdddelllllllllllll#hidddh.deddddddddddddemdddddddjddddddddddddddddddddddddddddddddddddddddbddmddcjnllllllllllleddddddddddn",
+"kdddddkdddelllllllllllllllndddenemddddddddddddddddddddddddddddddddddddddddcdddddddddddddddddddddkddddefllllllllllllleddddddddddg",
+"hdddddddddcllllllllllllllllkddddddddddddddemddddddddddddddddddddddddddddddcfjdddddddddddddddcddiiddcalllllllllllllllcdddddce.ddf",
+"bdddddddddclllllllllllllllllnddddddddcm.ddcg.dddddddddddddddddciddddddddddflnddddddddddddddddddhad.glllllllllllllllleda#kbf.dddf",
+"ndddddddd.illlllllllllllllllladddddddj#mdddhledddddddddddcdddegmddddddddddn#hddddd.mddddddddddddab#lllllllllllllllllcdegdckdccdg",
+"gdddcdaddiklllllllllllllllllllkdddddcachdddclledddccdddddaddb#eddddddddddddcdddddh#cddddddddddddmllllllllllllllllllliddamdicdidg",
+"#mddddbdddmlllllllllllllllllllljdddd.edncdddmlfdddhjdddddgngn.ddddddddddddcdddddjlhddddddddcdddcflllllllllllllllllllgcdchdccdcdf",
+"#eddddhcdd.llllllllllllllllllll#.ddddddnkddddglfcdgadddddgacdddddddddddddelhdddml#ddddddmcdddddfllllllllllllllllllllljddeddddddf",
+"fddddddcddellllllllllllllllllllllmdcdddjlcdddhllgklbdddddbcddddddddddddddj#cddilliddddddciddddjllllllllllllllllllllllfddddddcddn",
+"fdddmihcdd.llllllllllllllllllllllfcdddddiddddelllllmdddddhmdddddeddddddddccddm#lledddddddddddmllllllllllllllllllllllmcdddddddddn",
+"gdddkaniddelllllllllllllllllllllllhddddddcddddallllcdddddmndddcaidddddddddddelllfddddddddddddfllllllllllllllllllllllcdddcdehddda",
+"fdddbcddddmlllllllllllllllllllllllgdddddddcbdd.llllfddddddfdd.lmddddddddccdmlllljdddddddddddhlllllllllllllllllllllllcddddddaddda",
+"nddcadddddjlllllllllllllllllllllllliddddddekddclllllndddddmhdcmddddddcddddm#llllcddddddddddcllllllllllllllllllllllllcdddaedidddn",
+"nddd.mdddklllllllllllllllllllllllll#cddddddddddflllllncddddgedddddddmmddd.lllllfdddddjcddddhllllllllllllllllllllllllcdddeddddddn",
+"fddddmdddelllllllllllllllllllllllllljdddddccdddhllllllndcdddacddddddn.ddhllllllfdddddeddddclllllllllllllllllllllllllcdddddddddda",
+"gddddcddddfllllllllllllllllllllllllladddddfbdddcllllllladddd.ncdjddd#idilllllllkddddddddddillllllllllllllllllllllllleddddddddddn",
+"gdddddddddhlllllllllllllllllllllllll#cddddmgdddd#llllllladdddjlj#dddjlfllllllllnccddddddddnlllllllllllllllllllllllllcdddddddddda",
+"fdddddddddmllllllllllllllllllllllllll.ddeddbjccdflllllllladdddm#gddddglllllllllmcddddddddclllllllllllllllllllllllllleddheddddddn",
+"fdddicccdc.llllllllllllllllllllllllllhddddde#eddnlllllllllhddddemddcflllllllllbddddddddddellllllllllllllllllllllllllcddkghedddda",
+"fdddajdeddclllllllllllllllllllllllllladcddcdmbddblllllllllledddddddflllllllllliddddddddddjlllllllllllllllllllllllllledddcjeddddn",
+"adddanddddellllllllllllllllllllllllllfdeedekgfedilllllllllll.dddddfllllllllllljdddddddddd#lllllllllllllllllllllllllledddddddddda",
+"bdcdj.ddddcllllllllllllllllllllllllllfddddddcdddmlllllllllllgeddcallllllllllllmddddddddddkllllllllllllllllllllllllll.ddddddddddf",
+"kdddddddddcllllllllllllllllllllllllllfdddddddddd.llllllllllllgddkllllllllllllleddddddddddalllllllllllllllllllllllllleddddddddddf",
+"gihedddddmccejmmjihbannbaakbkbnffggffidd.cddddddmlnnffffnbknab.cbffg##l###lll#cddddddddddm#llll#fnngllllijhkbkhjm.ecdijddddd.bbl",
+"llgedddddnhdddddddddddddddddddddddddddddm.ddddddemdddddddddddddddddddccdccccecdddddddddddddc.lgeddddddciddddddddddddd#bdddddenll",
+"l#cdddddddjddddcccddddcdddddeddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddneddddddddncddddddddddddhddddddddnl",
+"lhddddddddddd.lnmcddddddddd.#cddddddddddddcddjadddddddddddddddddddddddddddddddd..ddddddddddddddddcdddbngddddacceedddddddddddddml",
+"lcddddddddddd.l.dddddddj.dd.#ddddddddddddddd.fikijddddjiddddddddddddddddddddddcfjddddddddddddddddcdddemfddmdikddddddddddddddddd#",
+"lddddddddddddcleddddddclaccj#dddddddddcddddcledddaddddddfjdddddkedddddd.cdddddd.idddddddcddddddddddddd.ndd.kdiedddddddddddddddc#",
+"leddddddddddddjmddcdddelgbbbhddddddmaniddddbnaeddjdddddddcddddeladddddcndddcddjljdddddmnadddddefgeddddendddkicadceedddddddddddel",
+"liddddddddddddd.ddcbacckddddddddddei.dddddddc#jdcjdcdddddddcdd.l#cdddeee.ddcddh#hdddddeeiddcddddddddddcinmdc.dn.h#.ddcddddddddhl",
+"l#ddddddddmdddddddddcdddddddddddiddddddddddefbddddddddddchghddc#lbddddifndddddddcdddddddidddjjddddddddddddddddab.hcddadddddddd#l",
+"ll#.dddddffddddddddddddddddddjdcl.ddddddddddcddddddddddddccdddddccdddddcabddddddddddddddhddddcddddccdddddddcdddddcdddg#.ddddegll",
+"llllfkik#l#.cddddddddceccjkem#..fg.ceeccccddccdccccddddddcceeee..m.ecccem#eecceeccccdddcbccccccdcdaicceeccccccccedddd#llgaafllll",
+"lllllllllllllgfg#gllllll#lllllllllllllll#l##l###lllgfgf##llllllllllllllllllllllllllll##ll#llll####lllllllllllllllabnalllllllllll"
+};
index d0ea41833daf994dc8def120c8ec2f5bb59a7d79..b8f81ad2ebb7e909951629677b3d79a9e492ca02 100644 (file)
@@ -63,4 +63,4 @@ stored in the RESOURCE_MANAGER property.
 .SH AUTHOR
 Juergen Nickelsen <nickel@cs.tu-berlin.de>, 23-aug-92.
 
-Hacked on by Jamie Zawinski <jwz@netscape.com>, 24-aug-92, 17-May-97.
+Hacked on by Jamie Zawinski <jwz@jwz.org>, 24-aug-92, 17-May-97.
index d436ebb4ecf4e689f01a3c5c53c45da2fda3d11f..d877a01b1cd44c8804f4182dab33814a4b5b40ab 100644 (file)
 
 # include <X11/Xutil.h>
 
+/* I thought it would be faster this way, but it turns out not to be... -jwz */
+#undef USE_XIMAGE
+#undef HAVE_XSHM_EXTENSION
+#undef HAVE_XDBE
+
+
 #ifdef HAVE_XDBE
 # include <X11/extensions/Xdbe.h>
 #endif /* HAVE_XDBE */
 
-
-/* I haven't gotten the shm stuff to work yet... and I'm not sure it would
-   help much anyway.  -- jwz */
-#undef HAVE_XSHM_EXTENSION
-
 #ifdef HAVE_XSHM_EXTENSION
-# include <sys/ipc.h>
-# include <sys/shm.h>
-# include <X11/extensions/XShm.h>
-#endif /*  HAVE_XSHM_EXTENSION */
-
-
-/* I thought it would be faster this way, but it turns out not to be... -jwz */
-/* #define USE_XIMAGE */
+# include "xshm.h"
+#endif /* HAVE_XSHM_EXTENSION */
 
 char *progclass="Interference";
 
@@ -84,11 +79,11 @@ char *defaults [] = {
   "*mono:        false", /* monochrome, not very much fun */
 
 #ifdef HAVE_XDBE
-  "*nodb:        true", /* don't use double buffering */
+  "*useDBE:      True", /* use double buffering extension */
 #endif /* HAVE_XDBE */
 
 #ifdef HAVE_XSHM_EXTENSION
-  "*noshm:        false", /* don't use shared memory */
+  "*useSHM:      True", /* use shared memory extension */
 #endif /*  HAVE_XSHM_EXTENSION */
   0
 };
@@ -104,10 +99,12 @@ XrmOptionDescRec options [] = {
   { "-gray",        ".gray",        XrmoptionNoArg,  "True" },
   { "-mono",        ".mono",        XrmoptionNoArg,  "True" },
 #ifdef HAVE_XDBE
-  { "-nodb",        ".nodb",        XrmoptionNoArg,  "True" },
+  { "-db",          ".useDBE",      XrmoptionNoArg,  "True" },
+  { "-no-db",       ".useDBE",      XrmoptionNoArg,  "False" },
 #endif /* HAVE_XDBE */
 #ifdef HAVE_XSHM_EXTENSION
-  { "-noshm",        ".noshm",      XrmoptionNoArg,  "True" },
+  { "-shm",    ".useSHM",      XrmoptionNoArg, "True" },
+  { "-no-shm", ".useSHM",      XrmoptionNoArg, "False" },
 #endif /*  HAVE_XSHM_EXTENSION */
   { 0, 0, 0, 0 }
 };
@@ -139,7 +136,7 @@ struct inter_context {
 #endif /* HAVE_XDBE */
 
 #ifdef HAVE_XSHM_EXTENSION
-  int use_shm;
+  Bool use_shm;
   XShmSegmentInfo shm_info;
 #endif /* HAVE_XSHM_EXTENSION */
 
@@ -192,7 +189,7 @@ void inter_init(Display* dpy, Window win, struct inter_context* c)
   int gray;
 #ifdef HAVE_XDBE
   int major, minor;
-  int nodb;
+  int use_dbe;
 #endif /* HAVE_XDBE */
 
   XGCValues val;
@@ -207,8 +204,8 @@ void inter_init(Display* dpy, Window win, struct inter_context* c)
   c->cmap = xgwa.colormap;
 
 #ifdef HAVE_XDBE
-  nodb = get_boolean_resource("nodb", "Boolean");
-  if(nodb) {
+  use_dbe = get_boolean_resource("useDBE", "Boolean");
+  if(!use_dbe) {
     c->has_dbe = False;
   } else {
     c->has_dbe = XdbeQueryExtension(dpy, &major, &minor);
@@ -216,7 +213,7 @@ void inter_init(Display* dpy, Window win, struct inter_context* c)
 #endif /* HAVE_XDBE */
 
 #ifdef HAVE_XSHM_EXTENSION
-  c->use_shm = !get_boolean_resource("noshm", "Boolean");
+  c->use_shm = get_boolean_resource("useSHM", "Boolean");
 #endif /*  HAVE_XSHM_EXTENSION */
 
 #ifdef HAVE_XDBE
@@ -253,27 +250,20 @@ void inter_init(Display* dpy, Window win, struct inter_context* c)
 
 #ifdef USE_XIMAGE
 
-# ifdef HAVE_XSHM_EXTENSION
+  c->ximage = 0;
 
+# ifdef HAVE_XSHM_EXTENSION
   if (c->use_shm)
     {
-      c->ximage = XShmCreateImage(dpy, xgwa.visual, xgwa.depth,
-                                 ZPixmap, 0, &c->shm_info,
-                                 xgwa.width, c->grid_size);
-      c->shm_info.shmid = shmget(IPC_PRIVATE,
-                                c->ximage->height * c->ximage->bytes_per_line,
-                                IPC_CREAT | 0777);
-      if (c->shm_info.shmid == -1)
-       printf ("shmget failed!");
-      c->shm_info.readOnly = False;
-      c->ximage->data = shmat(c->shm_info.shmid, 0, 0);
-      printf("data=0x%X %d %d\n", c->ximage->data,
-            c->ximage->height, c->ximage->bytes_per_line);
-      XShmAttach(dpy, &c->shm_info);
-      XSync(dpy, False);
+      c->ximage = create_xshm_image(dpy, xgwa.visual, xgwa.depth,
+                                   ZPixmap, 0, &c->shm_info,
+                                   xgwa.width, c->grid_size);
+      if (!c->ximage)
+       c->use_shm = False;
     }
-  else
 # endif /* HAVE_XSHM_EXTENSION */
+
+  if (!c->ximage)
     {
       c->ximage =
        XCreateImage (dpy, xgwa.visual,
@@ -421,19 +411,13 @@ void do_inter(struct inter_context* c)
             c->ximage->bytes_per_line);
 
     /* Move the bits for this horizontal stripe to the server. */
-#ifdef HAVE_XSHM_EXTENSION
+# ifdef HAVE_XSHM_EXTENSION
     if (c->use_shm)
-      {
-       /* wtf? we get a badmatch unless ximage->data == 0 ? */
-       char *d = c->ximage->data;
-       c->ximage->data = 0;
-       XShmPutImage(c->dpy, TARGET(c), c->copy_gc, c->ximage,
-                    0, 0, 0, g*j, c->ximage->width, c->ximage->height,
-                    False);
-       c->ximage->data = d;
-      }
+      XShmPutImage(c->dpy, TARGET(c), c->copy_gc, c->ximage,
+                  0, 0, 0, g*j, c->ximage->width, c->ximage->height,
+                  False);
     else
-#endif /*  HAVE_XSHM_EXTENSION */
+# endif /*  HAVE_XSHM_EXTENSION */
       XPutImage(c->dpy, TARGET(c), c->copy_gc, c->ximage,
                0, 0, 0, g*j, c->ximage->width, c->ximage->height);
 
index 0a21030761a06284e699d939a4fd6f799950f42d..83dcbe922f3e95cf2922d0ea2445872130a78f3e 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index b8a282061f0d5cc0d2a71b7d38aa590d5e9db47e..ae9f7a0ec472fd92af43f307e3936822bf034ae6 100644 (file)
@@ -71,4 +71,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 25-Nov-97.
+Jamie Zawinski <jwz@jwz.org>, 25-Nov-97.
index 680a5b196a03e73f65c1393d6fcc826bcb6c5120..29cbb558c8c5a1306a7d7ebce7c2f3b653f6e863 100644 (file)
@@ -20,8 +20,8 @@ static const char sccsid[] = "@(#)julia.c     4.03 97/04/10 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 28-May-97: jwz@netscape.com: added interactive frobbing with the mouse.
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 28-May-97: jwz@jwz.org: added interactive frobbing with the mouse.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 02-Dec-95: snagged boilerplate from hop.c
  *           used ifs {w0 = sqrt(x-c), w1 = -sqrt(x-c)} with random iteration 
  *           to plot the julia set, and sinusoidially varied parameter for set 
index 8b40e487ae666bc469bb8cbb3af13c816a32e638..1aa6809c522011b0e64f0bfb014530bb1339a20b 100644 (file)
@@ -80,4 +80,4 @@ supporting documentation.
 Sean McCullough <bankshot@mailhost.nmt.edu>, 1995.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 953f3c30e1920df7c315f505a6881bc7f9fc0a68..96db47c361d285d4c4d0d6f91374cb62c0dea217 100644 (file)
@@ -145,7 +145,7 @@ int x,y;
 int dx,dy;
 
 rx=Xrottable[stateX+1]-Xrottable[stateX];
-ry=Yrottable[stateX+1]-Yrottable[stateY];
+ry=Yrottable[stateY+1]-Yrottable[stateY];
 
 
 for (x=0;x<=rx;x++)
@@ -334,6 +334,23 @@ return (True);
 }
 
 
+#ifdef HAVE_XDBE_EXTENSION
+static XErrorHandler old_handler = 0;
+static Bool got_BadMatch = False;
+static int
+BadMatch_ehandler (Display *dpy, XErrorEvent *error)
+{
+  if (error->error_code == BadMatch) {
+    got_BadMatch = True;
+    return 0;
+  } else if (old_handler)
+    return old_handler(dpy, error);
+  else
+    exit(1);
+}
+#endif /* HAVE_XDBE_EXTENSION */
+
+
 Bool InitializeAll(void)
 {
 XGCValues xgcv;
@@ -388,7 +405,44 @@ if (usedouble)
                usedouble=False;
                }
        }
-if (usedouble) win[1]=XdbeAllocateBackBufferName(dpy,win[0],XdbeUndefined);
+if (usedouble)
+  {
+    /* We need to trap an X error when calling XdbeAllocateBackBufferName,
+       because there is no way to know beforehand whether the call will
+       succeed!  This is a totally fucked design, but the man page says:
+
+       ERRORS
+         BadMatch
+              The specified window is not an InputOutput window or
+              its visual does not support DBE.
+
+       With SGI's O2 X server, some visuals support double-buffering (the
+       12-bit pseudocolor visuals) and others yield a BadMatch error, as
+       documented.
+
+       However, it doesn't matter, because using the DBUF extension seems
+       to make it run *slower* instead of faster anyway.
+
+                                                        -- jwz, 1-Jul-98
+     */
+    XSync(dpy, False);
+    old_handler = XSetErrorHandler (BadMatch_ehandler);
+    got_BadMatch = False;
+    win[1] = 0;
+    win[1] = XdbeAllocateBackBufferName(dpy,win[0],XdbeUndefined);
+    XSync(dpy, False);
+    XSetErrorHandler (old_handler);
+    old_handler = 0;
+    XSync(dpy, False);
+    if (got_BadMatch || !win[1])
+      {
+       fprintf(stderr, "%s: visual 0x%x does not support double-buffering.\n",
+               progname, XVisualIDFromVisual(xgwa.visual));
+       usedouble = False;
+       win[1] = win[0];
+       got_BadMatch = False;
+      }
+  }
 #endif /* HAVE_XDBE_EXTENSION */
 
 delay=get_integer_resource("delay","Integer");
index a00809329724e58b55fb450fedcafc02e3c12797..de2a914471cee22244bfcce6c3e13bd670c45558 100644 (file)
@@ -16,7 +16,7 @@ static const char sccsid[] = "@(#)laser.c     4.00 97/01/01 xlockmore";
  * implied warranty.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  */
 
 #ifdef STANDALONE
index c219bfc741709abbff13f858fc50102a9f9843b0..70cec4e64930d4c7ec2d0d9f25dd9cc686dfc13e 100644 (file)
@@ -61,4 +61,4 @@ supporting documentation.
 Pascal Pensa <pensa@aurora.unice.fr>, 1995.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index baa255dd4e408465b122f9ef31d6fc9d0cdac0f1..77be5783a22fa3f0eabee252b57ab7af2b06161c 100644 (file)
@@ -20,7 +20,7 @@ static const char sccsid[] = "@(#)lightning.c 4.00 97/01/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 14-Jul-96: Cleaned up code.
  * 27-Jun-96: Written and submitted by Keith Romberg <kromberg@saxe.com>.
  */
index 7e602bfb6a2baa68e6cdae897474f0c07a598816..786ee99cfa9c3a09f8d776e1e4653188d156af0f 100644 (file)
@@ -55,4 +55,4 @@ supporting documentation.
 Keith Romberg <kromberg@saxe.com>, 27-Jun-96.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 0e9aeebac8c8ce09c3a480f16768eb38e31f84b0..64cc06f125e29c6ab521f35fd16effe124e65eb5 100644 (file)
@@ -64,4 +64,4 @@ supporting documentation.
 Caleb Cullen, 1997.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 27-May-97.
+Jamie Zawinski <jwz@jwz.org>, 27-May-97.
index 63ab3f691984c619725bf15f0f3a224f903e9e01..50cf8d21976322965947952e93dd0b5cd537f907 100644 (file)
@@ -55,4 +55,4 @@ stored in the RESOURCE_MANAGER property.
 .BR xscreensaver (1)
 .SH AUTHOR
 Sverre H. Huseby <sverrehu@online.no> and Glenn T. Lines <gtl@si.sintef.no>,
-built on top of the screen saver routines by Jamie Zawinski <jwz@netscape.com>.
+built on top of the screen saver routines by Jamie Zawinski <jwz@jwz.org>.
index 2593f235dad23be6df40b8f27a368a6dc5cfe9f3..d795e78e8bb83b61bd35383f26b48a57c7e300e2 100644 (file)
@@ -35,7 +35,7 @@
  *              Added bridge option.
  * modified:  [ 8-11-95 ] Ed James <james@mml.mmc.com>
  *              added fill of dead-end box to solve_maze while loop.
- * modified:  [ 3-7-93 ]  Jamie Zawinski <jwz@netscape.com>
+ * modified:  [ 3-7-93 ]  Jamie Zawinski <jwz@jwz.org>
  *             added the XRoger logo, cleaned up resources, made
  *             grid size a parameter.
  * modified:  [ 3-3-93 ]  Jim Randell <jmr@mddjmr.fc.hp.com>
@@ -1533,7 +1533,7 @@ enter_square (int n)                      /* move into a neighboring square */
 
 
 /*
- *  jmr additions for Jamie Zawinski's <jwz@netscape.com> screensaver stuff,
+ *  jmr additions for Jamie Zawinski's <jwz@jwz.org> screensaver stuff,
  *  note that the code above this has probably been hacked about in some
  *  arbitrary way.
  */
index 4b48484ce33f93ee7cb88ea0022711339b900c6e..f01fa28fe4e7e3bf9a73da888e83aded87684334 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 #include <X11/Xutil.h>
 #include <stdio.h>
 
-int offset = 0;
-XColor *colors = 0;
-int ncolors = 0;
-GC gc = 0;
-unsigned long fg_pixel = 0;
-unsigned long bg_pixel = 0;
+#ifdef HAVE_XSHM_EXTENSION
+# include "xshm.h"
+static Bool use_shm;
+static XShmSegmentInfo shm_info;
+#endif /* HAVE_XSHM_EXTENSION */
+
+static int offset = 0;
+static XColor *colors = 0;
+static int ncolors = 0;
+static GC gc = 0;
+static unsigned long fg_pixel = 0;
+static unsigned long bg_pixel = 0;
 
 static void
 init_moire (Display *dpy, Window window)
@@ -38,6 +44,10 @@ init_moire (Display *dpy, Window window)
   offset = get_integer_resource ("offset", "Integer");
   if (offset < 2) offset = 2;
 
+#ifdef HAVE_XSHM_EXTENSION
+  use_shm = get_boolean_resource("useSHM", "Boolean");
+#endif /*  HAVE_XSHM_EXTENSION */
+
  MONO:
   if (colors)
     {
@@ -128,13 +138,25 @@ moire (Display *dpy, Window window, int offset, XColor *colors, int ncolors)
   yo = (random() % xgwa.height) - xgwa.height/2;
 
   depth = visual_depth(DefaultScreenOfDisplay(dpy), xgwa.visual);
-  image = XCreateImage (dpy, xgwa.visual,
-                       depth, ZPixmap, 0,       /* depth, format, offset */
-                       0, xgwa.width, 1, 8, 0); /* data, w, h, pad, bpl */
 
-  image->data = (char *) malloc (((xgwa.width + 1) * depth / 8)
-                                * 2  /* uh, I dunno... */
-                                );
+  image = 0;
+# ifdef HAVE_XSHM_EXTENSION
+  if (use_shm)
+    {
+      image = create_xshm_image(dpy, xgwa.visual, depth, ZPixmap, 0,
+                               &shm_info, xgwa.width, 1);
+      if (!image)
+       use_shm = False;
+    }
+# endif /* HAVE_XSHM_EXTENSION */
+
+  if (!image)
+    {
+      image = XCreateImage (dpy, xgwa.visual,
+                           depth, ZPixmap, 0,      /* depth, format, offset */
+                           0, xgwa.width, 1, 8, 0); /* data, w, h, pad, bpl */
+      image->data = (char *) calloc(image->height, image->bytes_per_line);
+    }
 
   for (y = 0; y < xgwa.height; y++)
     {
@@ -149,11 +171,26 @@ moire (Display *dpy, Window window, int offset, XColor *colors, int ncolors)
            gcv.foreground = colors[((long) i) % ncolors].pixel;
          XPutPixel (image, x, 0, gcv.foreground);
        }
-      XPutImage (dpy, window, gc, image, 0, 0, 0, y, xgwa.width, 1);
+
+# ifdef HAVE_XSHM_EXTENSION
+      if (use_shm)
+       XShmPutImage(dpy, window, gc, image, 0, 0, 0, y, xgwa.width, 1, False);
+      else
+# endif /*  HAVE_XSHM_EXTENSION */
+       XPutImage (dpy, window, gc, image, 0, 0, 0, y, xgwa.width, 1);
+
       XSync(dpy, False);
     }
-  if (image->data) free(image->data);
-  image->data = 0;
+
+# ifdef HAVE_XSHM_EXTENSION
+  if (!use_shm)
+# endif /*  HAVE_XSHM_EXTENSION */
+    if (image->data)
+      {
+       free(image->data);
+       image->data = 0;
+      }
+
   XDestroyImage (image);
 }
 
@@ -167,6 +204,9 @@ char *defaults [] = {
   "*delay:             5",
   "*ncolors:           64",
   "*offset:            50",
+#ifdef HAVE_XSHM_EXTENSION
+  "*useSHM:          True",
+#endif /*  HAVE_XSHM_EXTENSION */
   0
 };
 
@@ -175,6 +215,10 @@ XrmOptionDescRec options [] = {
   { "-delay",          ".delay",       XrmoptionSepArg, 0 },
   { "-ncolors",                ".ncolors",     XrmoptionSepArg, 0 },
   { "-offset",         ".offset",      XrmoptionSepArg, 0 },
+#ifdef HAVE_XSHM_EXTENSION
+  { "-shm",            ".useSHM",      XrmoptionNoArg, "True" },
+  { "-no-shm",         ".useSHM",      XrmoptionNoArg, "False" },
+#endif /*  HAVE_XSHM_EXTENSION */
   { 0, 0, 0, 0 }
 };
 
index 4304710d08eb07c82183e8baff711de642a98637..c810265d0f6c793c5623e23116643c126f1d7ace 100644 (file)
@@ -60,5 +60,5 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 27-Apr-97, based on code by
+Jamie Zawinski <jwz@jwz.org>, 27-Apr-97, based on code by
 Michael D. Bayne <mdb@go2net.com>.
index ee85b89ebd9477b9ecb6ab60f5d301d6eb78023e..e714b5e085b879323561c05dc49ef1ea53719f39 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 352c5dc915410ac16cde143cd86a52655a1a51f9..84ff9608e332359332a29cb51590cc00503ebaa9 100644 (file)
@@ -9,7 +9,7 @@
  * 
  * Some code stolen from / This is meant to work with
  * xscreensaver, Copyright (c) 1992, 1995, 1996
- * Jamie Zawinski <jwz@netscape.com>
+ * Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index f23e8b6f47f10f36e91b078f6d82c9ec18e706b2..0afb52c85d58d8ec531d5535540bd8c068eb181b 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1996, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index fe18d8dfc35b8d1b8dc5320544cf2aeea7371189..f23746b51c20f8c1f9d514e5b125b0bef945a5f9 100644 (file)
@@ -71,4 +71,4 @@ Copyright 1985, 1990 by Dan Heller <argv@sun.com>.
 Dan Heller <argv@sun.com>, 1985.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
index 6454e283491fb1c224820af1faa313e2169c95b7..6e401aa673243b545f90a8fbd8fe719c8b216b81 100644 (file)
@@ -39,7 +39,7 @@ static const char sccsid[] = "@(#)penrose.c   4.00 97/01/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 09-Sep-96: Written.  */
 
 /*-
index 7460e39e6130c271bf411e8cef87cd5a39d8172d..db4c818c6c9c33530c4d8ea32df0d4c3c2a28922 100644 (file)
@@ -90,4 +90,4 @@ supporting documentation.
 Timo Korvola <tkorvola@dopey.hut.fi>, 1996.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index b62e17ac71c6fb4d2d72b58aa658ae23737b2788..05c12763b23c626e696778001bd5b58f2df733da 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1994, 1996
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 8edb9669c93d1b10008a64198d2f4ba789cebd6f..106fc8aa4177e5b5a30f0336d53ed9664bd820ab 100644 (file)
@@ -57,4 +57,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
index f2898f1ccff452b9e057b9368849af792b5d5ed4..c19f3bc6a33f9cd5e4f5f40438188739fefef91b 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 7d046fbfdd2ddc7ee5815a1ba03b1a1970e1e8a7..f7a033ae33541d51912a99d10a7f4da3b6763a98 100644 (file)
@@ -124,6 +124,6 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
 
 Thanks to Ariel Scolnicov for the \-poly and \-gravity options.
index 867ecf03a2f17680bc40dc521294a6447ff7d909..b420036c92058df73f7bef0b06eca9762cfe336a 100644 (file)
@@ -1,5 +1,5 @@
-/* xscreensaver, Copyright (c) 1992, 1995, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  *  reaction/diffusion textures
  *  Copyright (c) 1997 Scott Draves spot@transmeta.com
 #include <math.h>
 
 #include "screenhack.h"
+#include <X11/Xutil.h>
+
+#ifdef HAVE_XSHM_EXTENSION
+# include "xshm.h"
+#endif /* HAVE_XSHM_EXTENSION */
 
 /* costs ~6% speed */
 #define dither_when_mapped 1
 
-int verbose;
-int ncolors = 0;
-XColor *colors = 0;
-Display *display;
-Visual *visual;
+static int verbose;
+static int ncolors = 0;
+static XColor *colors = 0;
+static Display *display;
+static Visual *visual;
 #if dither_when_mapped
-unsigned char *mc = 0;
+static unsigned char *mc = 0;
 #endif
-Colormap cmap = 0;
-Window window;
-int mapped;
-int pdepth;
-void random_colors(void);
+static Colormap cmap = 0;
+static Window window;
+static int mapped;
+static int pdepth;
+static void random_colors(void);
 
 /* -----------------------------------------------------------
    pixel hack, 8-bit pixel grid, first/next frame interface
@@ -58,22 +63,29 @@ void random_colors(void);
 /* why strip bit? */
 #define R (ya_random()&((1<<30)-1))
 
-int frame = 0, epoch_time;
-ushort *r1, *r2, *r1b, *r2b;
-int width, height, npix;
-int radius;
-int reaction = 0;
-int diffusion = 0;
+static int frame = 0, epoch_time;
+static ushort *r1, *r2, *r1b, *r2b;
+static int width, height, npix;
+static int radius;
+static int reaction = 0;
+static int diffusion = 0;
 
 /* returns number of pixels that the pixack produces.  called once. */
-void
-pixack_init(int *size_h, int *size_v) {
+static void
+pixack_init(int *size_h, int *size_v) 
+{
   int sz_base;
   width = get_integer_resource ("width", "Integer");
   height = get_integer_resource ("height", "Integer");
   sz_base = 80 + (R%40);
   if (width <= 0) width = (R%20) ? sz_base : (28 + R%10);
   if (height <= 0) height = (R%20) ? sz_base : (28 + R%10);
+
+  /* jwz: when (and only when) XSHM is in use on an SGI 8-bit visual,
+     we get shear unless width is a multiple of 4.  I don't understand
+     why.  This is undoubtedly the wrong fix... */
+  width &= ~0x7;
+
   /* don't go there */
   if (width < 10) width = 10;
   if (height < 10) height = 10;
@@ -97,8 +109,9 @@ pixack_init(int *size_h, int *size_v) {
 
 
 /* returns the pixels.  called many times. */
-void
-pixack_frame(char *pix_buf) {
+static void
+pixack_frame(char *pix_buf) 
+{
   int i, j;
   int w2 = width + 2;
   ushort *t;
@@ -295,6 +308,9 @@ char *defaults [] = {
   "*size:      0.66",
   "*delay:     1",
   "*colors:    -1",
+#ifdef HAVE_XSHM_EXTENSION
+  "*useSHM:    True",
+#endif /* HAVE_XSHM_EXTENSION */
   0
 };
 
@@ -310,22 +326,17 @@ XrmOptionDescRec options [] = {
   { "-size",           ".size",        XrmoptionSepArg, 0 },
   { "-delay",          ".delay",       XrmoptionSepArg, 0 },
   { "-ncolors",                ".colors",      XrmoptionSepArg, 0 },
+#ifdef HAVE_XSHM_EXTENSION
+  { "-shm",            ".useSHM",      XrmoptionNoArg, "True" },
+  { "-no-shm",         ".useSHM",      XrmoptionNoArg, "False" },
+#endif /* HAVE_XSHM_EXTENSION */
   { 0, 0, 0, 0 }
 };
 
 
-/* why doesn't this work???  and more importantly, do i really still have
-   to do this in X? */
-   
-#ifdef HAVE_XSHM_EXTENSION
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#endif
-
-
-void
-random_colors() {
+static void
+random_colors(void)
+{
   memset(colors, 0, ncolors*sizeof(*colors));
   make_smooth_colormap (display, visual, cmap, colors, &ncolors,
                        True, 0, True);
@@ -372,7 +383,7 @@ screenhack (Display *dpy, Window win)
   int vdepth;
   int npix;
 #ifdef HAVE_XSHM_EXTENSION
-  int use_shm = 0;
+  Bool use_shm = get_boolean_resource("useSHM", "Boolean");
   XShmSegmentInfo shm_info;
 #endif
 
@@ -403,6 +414,11 @@ screenhack (Display *dpy, Window win)
     array_y = (xgwa.height - array_height)/2;
     array_dx = p;
     array_dy = .31415926 * p;
+
+    /* start in a random direction */
+    if (random() & 1) array_dx = -array_dx;
+    if (random() & 1) array_dy = -array_dy;
+
   }
   verbose = get_boolean_resource ("verbose", "Boolean");
   npix = (width + 2) * (height + 2);
@@ -453,57 +469,75 @@ screenhack (Display *dpy, Window win)
     exit(1);
   }
 
+  image = 0;
+
 #ifdef HAVE_XSHM_EXTENSION
-  if (use_shm) {
-    printf("p=%X\n", p);
-    free(p);
-    image = XShmCreateImage(dpy, xgwa.visual, vdepth,
-                           ZPixmap, 0, &shm_info, width, height);
-    shm_info.shmid = shmget(IPC_PRIVATE,
-                           image->bytes_per_line * image->height,
-                           IPC_CREAT | 0777);
-    if (shm_info.shmid == -1)
-      printf ("shmget failed!");
-    shm_info.readOnly = False;
-    p = shmat(shm_info.shmid, 0, 0);
-    printf("p=%X %d\n", p, image->bytes_per_line);
-    XShmAttach(dpy, &shm_info);
-    XSync(dpy, False);
-  } else
-#endif
-  image = XCreateImage(dpy, xgwa.visual, vdepth,
-                      ZPixmap, 0, p,
-                      width, height, 8, 0);
+  if (use_shm)
+    {
+      image = create_xshm_image(dpy, xgwa.visual, vdepth,
+                               ZPixmap, 0, &shm_info, width, height);
+      if (!image)
+       use_shm = False;
+      else
+       {
+         free(p);
+         p = image->data;
+       }
+    }
+#endif /* HAVE_XSHM_EXTENSION */
+
+  if (!image)
+    {
+      image = XCreateImage(dpy, xgwa.visual, vdepth,
+                          ZPixmap, 0, p,
+                          width, height, 8, 0);
+    }
 
   while (1) {
+    Bool bump = False;
+
     int i, j;
     pixack_frame(p);
     for (i = 0; i < array_width; i += width)
       for (j = 0; j < array_height; j += height)
 #ifdef HAVE_XSHM_EXTENSION
        if (use_shm)
-         XShmPutImage(dpy, win, gc, image, 0, 0, i, j,
+         XShmPutImage(dpy, win, gc, image, 0, 0, i+array_x, j+array_y,
                       width, height, False);
        else
 #endif
-         XPutImage(dpy, win, gc, image, 0, 0, i+array_x, j+array_y, width, height);
+         XPutImage(dpy, win, gc, image, 0, 0, i+array_x, j+array_y,
+                   width, height);
 
     array_x += array_dx;
     array_y += array_dy;
     if (array_x < 0) {
       array_x = 0;
       array_dx = -array_dx;
+      bump = True;
     } else if (array_x > (xgwa.width - array_width)) {
       array_x = (xgwa.width - array_width);
       array_dx = -array_dx;
+      bump = True;
     }
     if (array_y < 0) {
       array_y = 0;
       array_dy = -array_dy;
+      bump = True;
     } else if (array_y > (xgwa.height - array_height)) {
       array_y = (xgwa.height - array_height);
       array_dy = -array_dy;
+      bump = True;
     }
+
+    if (bump) {
+      if (random() & 1) {
+       double swap = array_dx;
+       array_dx = array_dy;
+       array_dy = swap;
+      }
+    }
+
     frame++;
 
     XSync(dpy, False);
index f70f26c2ab240c02a403acf3ec6e10f06854626d..aceef3bcf8073fe2b30981bbad08a16527777f7a 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 18d16ab4b96ee42439744177d278a63b31d3d418..1d391306169d09bbd383e3ab4b38e8226fd4bacf 100644 (file)
@@ -81,6 +81,6 @@ express or implied warranty.
 .SH AUTHOR
 Based on Lisp Machine code copyright 1988 John Nguyen <johnn@hx.lcs.mit.edu>.
 
-Ported to C and X by Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Ported to C and X by Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
 
 Steering code by Jeremie Petit; 3D code by theiling@coli.uni-sb.de.
index 4b623628449a5a21de27de7961be7a77fcc722ff..3c1a20e5fe9a9a59af3fdff586c336cfccf95082 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1996 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1996 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index c89b1704e442c274a4ee81d568354bd401b63e54..56a6c4877b981ddd19ea75f7db727b8a573cb2bd 100644 (file)
@@ -72,4 +72,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
index 1f99b3ab495302d9d8def8840d93850fd400e02f..4d169939018de416fe59c05513d15aaab4b5ea1c 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -226,7 +226,7 @@ main (int argc, char **argv)
       Bool help_p = !strcmp(argv[1], "-help");
       fprintf (stderr, "%s\n", version);
       for (s = progclass; *s; s++) fprintf(stderr, " ");
-      fprintf (stderr, "  http://people.netscape.com/jwz/xscreensaver/\n\n");
+      fprintf (stderr, "  http://www.jwz.org/xscreensaver/\n\n");
 
       if (!help_p)
        fprintf(stderr, "Unrecognised option: %s\n", argv[1]);
index a92cf70dc32672284c8c773ce8abfa922cb48225..bb0344fb7543ec30f007ffef34168f53c20331eb 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index de108a703117483f3907d28263b30a4d4bf6e2cd..ca22999c147f0dd083ad443dbc5e3255b806277a 100644 (file)
@@ -22,7 +22,7 @@ static const char sccsid[] = "@(#)sierpinski.c        4.05 97/09/19 xlockmore";
  * Revision History:
  * 18-Sep-97: 3D version Antti Kuntsi <kuntsi@iki.fi>.
  * 20-May-97: Changed the name tri to sierpinski for more compatiblity
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 05-Sep-96: Desmond Daignault Datatimes Incorporated
  *            <tekdd@dtol.datatimes.com> .
  */
index e2bc41a6f403071e43c97c124ec37b33ba5e83d8..f3fdb34a170846868358b562e3beeddf51a032c0 100644 (file)
@@ -62,4 +62,4 @@ Desmond Daignault <tekdd@dtol.datatimes.com>, 05-Sep-96.  (Original
 xlock version was called tri.c.)
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.  (Renamed to sierpinski.)
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.  (Renamed to sierpinski.)
index 366cdfb9ab5072257a3d763c3b361c68ae75e601..9415ac22049aaccd5842e29d0b1784558e8aee97 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997 
- * Jamie Zawinski <jwz@netscape.com>
+ * Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index fac500337d01b01d243b86ac2381c7b3b19f43ec..a3e9d902f5fc65aeff5ad9a978dc1c443d8c0251 100644 (file)
@@ -89,4 +89,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 3-dec-92.
+Jamie Zawinski <jwz@jwz.org>, 3-dec-92.
index e21bd2c479d0ae0bd91e16d5c560bf6e5694af97..91694e93e994b332d606655d6ecb4e7e1eb15173 100644 (file)
@@ -20,7 +20,7 @@ static const char sccsid[] = "@(#)slip.c      4.00 97/01/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 12-May-97: jwz@netscape.com: turned into a standalone program.
+ * 12-May-97: jwz@jwz.org: turned into a standalone program.
  * 01-Dec-95: Patched for VMS <joukj@alpha.chem.uva.nl>.
  */
 
index f18d367fe57781f41ac43623e295c8426eabb53a..d513654c2e61cda72963fe95b4dba1e19d769462 100644 (file)
@@ -90,4 +90,4 @@ supporting documentation.
 Scott Graves <spot@cs.cmu.edu>.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 18-Oct-93.
+Jamie Zawinski <jwz@jwz.org>, 18-Oct-93.
index 728c72406e00699758f2045b48f88bd5d109bc97..cffe98424e79bf480eb8e31183719745932874c3 100644 (file)
@@ -29,8 +29,8 @@ static const char sccsid[] = "@(#)sphere.c    4.00 97/01/01 xlockmore";
  * ***************************************************************************
  *
  * Revision History:
- * 30-May-97: jwz@netscape.com: made it go vertically as well as horizontally.
- * 27-May-97: jwz@netscape.com: turned into a standalone program.
+ * 30-May-97: jwz@jwz.org: made it go vertically as well as horizontally.
+ * 27-May-97: jwz@jwz.org: turned into a standalone program.
  * 2-Sep-93: xlock version (David Bagley bagleyd@bigfoot.com)
  * 1988: Revised to use SunView canvas instead of gfxsw Sun Microsystems
  * 1982: Orignal Algorithm  Tom Duff  Lucasfilm Ltd.
index 89189884a99bb1a8cc4e7ddc56cf048debc1f982..1632ab9e9f71f598ae408cc529d2ad97d9db0094 100644 (file)
@@ -55,4 +55,4 @@ supporting documentation.
 Sun Microsystems, Inc, 1988.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 27-May-97.
+Jamie Zawinski <jwz@jwz.org>, 27-May-97.
index 24b2b73caa1dd772fdce14e7f0f799703f16fa5f..10d319a647fc29ac0f2df11f91e1b71c26641a12 100644 (file)
@@ -24,7 +24,7 @@ static const char sccsid[] = "@(#)spiral.c    4.00 97/01/01 xlockmore";
  * See xlock.c for copying information.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 24-Jul-95: Fix to allow cycles not to have an arbitrary value by
  *            Peter Schmitzberger (schmitz@coma.sbg.ac.at).
  * 06-Mar-95: Finished cleaning up and final testing.
index eeb8850bb4f35d38041c974e06370b98fb80651e..a32db1e8e828214e1d41e3435fff0b72089ec97d 100644 (file)
@@ -64,4 +64,4 @@ Darrick Brown, 1994.
 Improved by Peter Schmitzberger <schmitz@coma.sbg.ac.at>, 24-Jul-95.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 89638197312eb1749c5fcc9ae879de4022263267..e368164d07b273609e232fb42c6c90648cc898bc 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 461349fe53a68a45b63b71b50c4167c3598c3ff4..63c70d4e71db2f8fa3c3a933f7c3d098e641e081 100644 (file)
@@ -86,4 +86,4 @@ appear in supporting documentation.  No representations are made about the
 suitability of this software for any purpose.  It is provided "as is" without
 express or implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 14-Jun-97.
+Jamie Zawinski <jwz@jwz.org>, 14-Jun-97.
index 71cd89cdbbc0abd8a4a1ef8831abdff168f53dd9..a1bda34f70ad7ef277fc405f86b84e81d74164c4 100644 (file)
@@ -20,7 +20,9 @@ static const char sccsid[] = "@(#)strange.c      4.02 97/04/01 xlockmore";
  * other special, indirect and consequential damages.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 30-Jul-98: sineswiper@resonatorsoft.com: added curve factor (discovered
+ *         while experimenting with the Gauss_Rand function).
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  *                       Made it render into an offscreen bitmap and then copy
  *                       that onto the screen, to reduce flicker.
  */
@@ -38,9 +40,6 @@ static const char sccsid[] = "@(#)strange.c      4.02 97/04/01 xlockmore";
 # include "xlock.h"                                    /* from the xlockmore distribution */
 #endif /* !STANDALONE */
 
-ModeSpecOpt strange_opts = {
-  0, NULL, 0, NULL, NULL };
-
 /*****************************************************/
 /*****************************************************/
 
@@ -87,6 +86,19 @@ static PRM  xmin, xmax, ymin, ymax;
 static PRM  Prm[MAX_PRM];
 static PRM *Fold = NULL;
 
+static int curve;
+
+static XrmOptionDescRec opts[] =
+{
+       {"-curve", ".strange.curve", XrmoptionSepArg, (caddr_t) "10"},
+};
+static OptionStruct desc[] =
+{
+       {"-curve", "set the curve factor of the attractors"},
+};
+
+ModeSpecOpt strange_opts = { 1, opts, 0, NULL, desc };
+
 /******************************************************************/
 /******************************************************************/
 
@@ -106,10 +118,11 @@ static DBL  Mid_Prm[MAX_PRM] =
 static      DBL
 Gauss_Rand(DBL c, DBL A, DBL S)
 {
-       DBL         y;
+       DBL         y,z;
 
        y = (DBL) LRAND() / MAXRAND;
-       y = A * (1.0 - exp(-y * y * S)) / (1.0 - exp(-S));
+       z = curve / 10;
+       y = A * (z - exp(-y * y * S)) / (z - exp(-S));
        if (NRAND(2))
                return (c + y);
        else
@@ -298,6 +311,9 @@ init_strange(ModeInfo * mi)
 {
        ATTRACTOR  *Attractor;
 
+       curve = get_integer_resource ("curve", "Integer");
+       if (curve <= 0) curve = 10;
+
        if (Root == NULL) {
                Root = (ATTRACTOR *) calloc(
                                     MI_NUM_SCREENS(mi), sizeof (ATTRACTOR));
index ff278d39b38bc29f0fd2de8a74c72540c61267d2..088a9eed5a1a65a2c722a0ba4b6f60485d1041cd 100644 (file)
@@ -55,4 +55,4 @@ supporting documentation.
 Massimino Pascal <Pascal.Massimon@ens.fr>, 1997.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 0d0f5abf4f56472a2e32529d898aa293c84e1c7f..5ea1598c54efe007530ea299307c6151fe22f471 100644 (file)
@@ -19,7 +19,7 @@ static const char sccsid[] = "@(#)swirl.c     4.00 97/01/01 xlockmore";
  * event will the author be liable for any lost revenue or profits or
  * other special, indirect and consequential damages.
  *
- * 13-May-97: jwz@netscape.com: turned into a standalone program.
+ * 13-May-97: jwz@jwz.org: turned into a standalone program.
  * 21-Apr-95: improved startup time for TrueColour displays
  *            (limited to 16bpp to save memory) S.Early <sde1000@cam.ac.uk>
  * 09-Jan-95: fixed colour maps (more colourful) and the image now spirals
@@ -36,13 +36,18 @@ static const char sccsid[] = "@(#)swirl.c   4.00 97/01/01 xlockmore";
 # define swirl_opts                                    xlockmore_opts
 # define DEFAULTS      "*count:                5       \n"                     \
                                        "*delay:                10000   \n"                     \
-                                       "*ncolors:              200     \n"
+                                       "*ncolors:              200     \n"                     \
+                                       "*useSHM:               True    \n"
 # define SMOOTH_COLORS
 # define WRITABLE_COLORS
 # include "xlockmore.h"                                /* from the xscreensaver distribution */
 # include <X11/Xutil.h>
+# ifdef HAVE_XSHM_EXTENSION
+#  include "xshm.h"
+# endif /* HAVE_XSHM_EXTENSION */
 #else  /* !STANDALONE */
 # include "xlock.h"                                    /* from the xlockmore distribution */
+# undef HAVE_XSHM_EXTENSION
 #endif /* !STANDALONE */
 
 ModeSpecOpt swirl_opts = {
@@ -248,11 +253,26 @@ initialise_image(ModeInfo * mi, SWIRL_P swirl)
   if (swirl->ximage != NULL)
        XDestroyImage(swirl->ximage);
 
-  swirl->ximage = XCreateImage(dpy, swirl->visual, swirl->rdepth, ZPixmap,
-                                                          0, 0, swirl->width, swirl->height,
-                                                          8, 0);
-  swirl->ximage->data = swirl->image =
-       (unsigned char *) calloc(swirl->height, swirl->ximage->bytes_per_line);
+  swirl->ximage = 0;
+#ifdef HAVE_XSHM_EXTENSION
+  if (mi->use_shm)
+       {
+         swirl->ximage = create_xshm_image(dpy, swirl->visual, swirl->rdepth,
+                                                                               ZPixmap, 0, &mi->shm_info,
+                                                                               swirl->width, swirl->height);
+         if (!swirl->ximage)
+               mi->use_shm = False;
+       }
+#endif /* HAVE_XSHM_EXTENSION */
+
+  if (!swirl->ximage)
+       {
+         swirl->ximage = XCreateImage(dpy, swirl->visual, swirl->rdepth, ZPixmap,
+                                                                  0, 0, swirl->width, swirl->height,
+                                                                  8, 0);
+         swirl->ximage->data = swirl->image =
+               (char *) calloc(swirl->height, swirl->ximage->bytes_per_line);
+       }
 }
 
 /****************************************************************/
@@ -1107,10 +1127,17 @@ draw_point(ModeInfo * mi, SWIRL_P swirl)
                draw_block(swirl->ximage, x, y, r, do_point(swirl, x, y));
 
        /* update the screen */
-/* PURIFY 4.0.1 on SunOS4 and on Solaris 2 reports a 256 byte memory leak on * 
-   the next line. */
-       XPutImage(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi), swirl->ximage,
-                 x, y, x, y, r, r);
+
+#ifdef HAVE_XSHM_EXTENSION
+       if (mi->use_shm)
+         XShmPutImage(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi), swirl->ximage,
+                                  x, y, x, y, r, r, False);
+       else
+#endif /* !HAVE_XSHM_EXTENSION */
+         /* PURIFY 4.0.1 on SunOS4 and on Solaris 2 reports a 256 byte memory
+                leak on the next line. */
+         XPutImage(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi), swirl->ximage,
+                               x, y, x, y, r, r);
 }
 
 /****************************************************************/
index 763746130e1e920df668154653ecb6e42f637342..c36733fccdb00447649a5eb561d742fabbe4b68e 100644 (file)
@@ -61,4 +61,4 @@ supporting documentation.
 M.Dobie <mrd@ecs.soton.ac.uk>, 1994.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 13-May-97.
+Jamie Zawinski <jwz@jwz.org>, 13-May-97.
index a2ab029b99c0cb54e99b8660e75ada37f0bde51e..4652aab4d48f7852f399280255f455687d237288 100755 (executable)
@@ -274,7 +274,7 @@ main() {
 
   getargs $@
 
-  trap my_trap 0 1 2 3 6 9 13
+  trap my_trap 0 1 2 3 6 9 13 15
 
   if [ "$use_stdin" = true ]; then
    cat > $tmp_ppm0
@@ -311,8 +311,15 @@ main() {
          ls -lF $tmp_ppm2
         fi
 
-       # cat the file so that we can nuke it without racing against xv.
-        cat $tmp_ppm2 | xv $xvargs - &
+       mv $tmp_ppm2 $tmp_ppm0
+        xv $xvargs $tmp_ppm0 &
+
+# this doesn't work -- leaves xv processes around, instead of stray xset
+# data.  Sigh.
+#
+#      # cat the file so that we can nuke it without racing against xv.
+#        cat $tmp_ppm2 | xv $xvargs - &
+
         pid=$!
       fi
     fi
index 2002946e287a521e6e30eef2692a5c72474ccce1..4c562f9d344811170efe55db40f374382269cfb3 100644 (file)
@@ -16,7 +16,7 @@ static const char sccsid[] = "@(#)vines.c     4.02 97/04/01 xlockmore";
  * nifty whorls and loops.
  *
  * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
+ * 10-May-97: jwz@jwz.org: turned into a standalone program.
  * 21-Mar-97:  David Hansen <dhansen@metapath.com>
  *             Updated mode to draw complete patterns on every
  *             iteration instead of growing the vine.  Also made
index 0245cdc79439ca83135dfaee310c099f2857bdf8..13b7dee770802aa607837a2143fcb5ce4775f5be 100644 (file)
@@ -59,4 +59,4 @@ Tracy Camp <campt@hurrah.com>, 1997.
 Tweaked by David Hansen <dhansen@metapath.com>, 21-Mar-97.
 
 Ability to run standalone or with \fIxscreensaver\fP added by 
-Jamie Zawinski <jwz@netscape.com>, 10-May-97.
+Jamie Zawinski <jwz@jwz.org>, 10-May-97.
index 5711be45d8c123d7863d3d158677c6801598b1cb..8f8c1a343dcb76e1c20fa47cc4811a9fce679640 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 4d31fe25fc694510a46821cb98766676d4b2fca4..390e95fce73bac7fee63716a4a8b923eca750e10 100644 (file)
@@ -48,4 +48,4 @@ makes jack a dull boy.  All work and no play makes jack a dull boy.  All work
 and no play makes jack a fnord dull boy.  All work and no play makes jack a
 dull boy.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 15-Nov-97.
+Jamie Zawinski <jwz@jwz.org>, 15-Nov-97.
index f84f4919a6c3448734bea58c60348d5629bd430f..540bc264d861321699ba0a648650bcc5be7cb974 100644 (file)
@@ -1,5 +1,5 @@
 /* xlockmore.c --- xscreensaver compatibility layer for xlockmore modules.
- * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -11,7 +11,7 @@
  *
  * This file, along with xlockmore.h, make it possible to compile an xlockmore
  * module into a standalone program, and thus use it with xscreensaver.
- * By Jamie Zawinski <jwz@netscape.com> on 10-May-97; based on the ideas
+ * By Jamie Zawinski <jwz@jwz.org> on 10-May-97; based on the ideas
  * in the older xlock.h by Charles Hannum <mycroft@ai.mit.edu>.  (I had
  * to redo it, since xlockmore has diverged so far from xlock...)
  */
@@ -61,7 +61,7 @@ pre_merge_options (void)
   /* Add extra args, if they're mentioned in the defaults... */
   {
     char *args[] = { "-count", "-cycles", "-delay", "-ncolors",
-                    "-size", "-wireframe", "-use3d" };
+                    "-size", "-wireframe", "-use3d", "-useSHM" };
     for (j = 0; j < countof(args); j++)
       if (strstr(app_defaults, args[j]+1))
        {
@@ -90,6 +90,17 @@ pre_merge_options (void)
              new->argKind = XrmoptionNoArg;
              new->value = "False";
            }
+         else if (!strcmp(new->option, "-useSHM"))
+           {
+             new->option = "-shm";
+             new->argKind = XrmoptionNoArg;
+             new->value = "True";
+             new = &options[i++];
+             new->option = "-no-shm";
+             new->specifier = options[i-2].specifier;
+             new->argKind = XrmoptionNoArg;
+             new->value = "False";
+           }
          else
            {
              new->argKind = XrmoptionSepArg;
@@ -280,29 +291,6 @@ xlockmore_screenhack (Display *dpy, Window window,
   mi.batchcount = get_integer_resource ("count", "Int");
   mi.size      = get_integer_resource ("size", "Int");
 
-#if 0
-  decay = get_boolean_resource ("decay", "Boolean");
-  if (decay) mi.fullrandom = False;
-
-  trail = get_boolean_resource ("trail", "Boolean");
-  if (trail) mi.fullrandom = False;
-
-  grow = get_boolean_resource ("grow", "Boolean");
-  if (grow) mi.fullrandom = False;
-
-  liss = get_boolean_resource ("liss", "Boolean");
-  if (liss) mi.fullrandom = False;
-
-  ammann = get_boolean_resource ("ammann", "Boolean");
-  if (ammann) mi.fullrandom = False;
-
-  jong = get_boolean_resource ("jong", "Boolean");
-  if (jong) mi.fullrandom = False;
-
-  sine = get_boolean_resource ("sine", "Boolean");
-  if (sine) mi.fullrandom = False;
-#endif
-
   mi.threed = get_boolean_resource ("use3d", "Boolean");
   mi.threed_delta = get_float_resource ("delta3d", "Boolean");
   mi.threed_right_color = get_pixel_resource ("right3d", "Color", dpy,
@@ -316,7 +304,9 @@ xlockmore_screenhack (Display *dpy, Window window,
 
   mi.wireframe_p = get_boolean_resource ("wireframe", "Boolean");
   mi.root_p = (window == RootWindowOfScreen (mi.xgwa.screen));
-
+#ifdef HAVE_XSHM_EXTENSION
+  mi.use_shm = get_boolean_resource ("useSHM", "Boolean");
+#endif /* !HAVE_XSHM_EXTENSION */
 
   if (mi.pause < 0)
     mi.pause = 0;
index b0b7ec41cf005c1ead15c6753746862d6bd7a5ca..4274aa63e9b6f35b371b765c1cff22ebf0459736 100644 (file)
@@ -1,5 +1,5 @@
 /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
- * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -11,7 +11,7 @@
  *
  * The definitions in this file make it possible to compile an xlockmore
  * module into a standalone program, and thus use it with xscreensaver.
- * By Jamie Zawinski <jwz@netscape.com> on 10-May-97; based on the ideas
+ * By Jamie Zawinski <jwz@jwz.org> on 10-May-97; based on the ideas
  * in the older xlock.h by Charles Hannum <mycroft@ai.mit.edu>.  (I had
  * to redo it, since xlockmore has diverged so far from xlock...)
  */
@@ -73,6 +73,9 @@ ERROR!  Sorry, xlockmore.h requires ANSI C (gcc, for example.)
 #define MI_CYCLES(MI)          ((MI)->cycles)
 #define MI_BATCHCOUNT(MI)      ((MI)->batchcount)
 #define MI_SIZE(MI)            ((MI)->size)
+#define MI_IS_DRAWN(MI)                ((MI)->is_drawn)
+#define MI_IS_DEBUG(MI)                (False)
+#define MI_NAME(MI)            (progname)
 
 #define MI_WIDTH(MI)           (MI_WIN_WIDTH((MI)))
 #define MI_HEIGHT(MI)          (MI_WIN_HEIGHT((MI)))
index 48279640b7d074448807cf9a9ea61a782272d94f..3629804c52565a34683b5a670ff8429d8483ea86 100644 (file)
@@ -1,5 +1,5 @@
 /* xlockmore.h --- xscreensaver compatibility layer for xlockmore modules.
- * xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+ * xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
 
 #include "screenhack.h"
 
+#ifdef HAVE_XSHM_EXTENSION
+# include "xshm.h"
+#endif /* HAVE_XSHM_EXTENSION */
+
+
 /* I'm told that the Sun version of OpenGL needs to have the constant
    SUN_OGL_NO_VERTEX_MACROS defined in order for morph3d to compile
    (the number of arguments to the glNormal3f macro changes...)
@@ -63,6 +68,13 @@ typedef struct ModeInfo {
   long threed_none_color;
   long threed_delta;
   Bool wireframe_p;
+  Bool is_drawn;
+
+#ifdef HAVE_XSHM_EXTENSION
+  Bool use_shm;
+  XShmSegmentInfo shm_info;
+#endif
+
 } ModeInfo;
 
 typedef enum {  t_String, t_Float, t_Int, t_Bool } xlockmore_type;
index 908d8d82374207bac9991675d9691cae807e6706..7557dce35064c6a212aeb027323bd0bb6176a2bc 100644 (file)
@@ -597,7 +597,7 @@ static int
 complyap(void)
 {
   register i, bindex;
-  double total, prod, x, r;
+  double total, prod, x, dx, r;
 
   if (!run)
     return TRUE;
@@ -646,7 +646,14 @@ complyap(void)
   if (useprod) {      /* using log(a*b) */
     for (i=0;i<dwell;i++) {
       x = (*map)(x, r);
-      prod *= ABS((*deriv)(x, r));
+      dx = (*deriv)(x, r); /* ABS is a macro, so don't be fancy */
+      dx = ABS(dx);
+      if (dx == 0.0) /* log(0) is nasty so break out. */
+      {
+        i++;
+        break;
+      }
+      prod *= dx;
       /* we need to prevent overflow and underflow */
       if ((prod > 1.0e12) || (prod < 1.0e-12)) {
        total += log(prod);
@@ -666,12 +673,19 @@ complyap(void)
 #endif
     }
     total += log(prod);
-    lyapunov = (total * M_LOG2E) / (double)dwell;
+    lyapunov = (total * M_LOG2E) / (double)i;   
   }
   else {       /* use log(a) + log(b) */
     for (i=0;i<dwell;i++) {
       x = (*map)(x, r);
-      total += log(ABS((*deriv)(x, r)));
+      dx = (*deriv)(x, r); /* ABS is a macro, so don't be fancy */
+      dx = ABS(dx);
+      if (x == 0.0)  /* log(0) check */
+      {
+        i++;
+        break;
+      }
+      total += log(dx);
       if (++bindex >= maxindex) {
        bindex = 0;
        if (Rflag)
@@ -685,8 +699,9 @@ complyap(void)
       deriv = Derivs[Forcing[findex]];
 #endif
     }
-    lyapunov = (total * M_LOG2E) / (double)dwell;
+    lyapunov = (total * M_LOG2E) / (double)i;
   }
+
   if (sendpoint(lyapunov) == TRUE)
     return FALSE;
   else {
@@ -1422,6 +1437,15 @@ sendpoint(double expo)
   static int index;
   static double tmpexpo;
 
+#if 0
+/* The relationship minexp <= expo <= maxexp should always be true. This test
+   enforces that. But maybe not enforcing it makes better pictures. */
+  if (expo < minexp)
+    expo = minexp;
+  else if (expo > maxexp)
+    expo = maxexp;
+#endif
+
   point.x++;
   tmpexpo = (negative) ? expo : -1.0 * expo;
   if (tmpexpo > 0) {
@@ -1854,6 +1878,14 @@ InitBuffer(void)
 static void
 BufferPoint(Display *display, Window window, int color, int x, int y)
 {
+
+/* Guard against bogus color values. Shouldn't be necessary but paranoia
+   is good. */
+  if (color < 0)
+    color = 0;
+  else if (color >= maxcolor)
+    color = maxcolor - 1;
+
   if (Points.npoints[color] == MAXPOINTS)
   {
     XDrawPoints(display, window, Data_GC[color],
index 0138c64aee496652caff416c9c4296dd8ab11957..278189c50216dfbbce98eef8333215c983dc59c0 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1994 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1994 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 799f5005d915ab8a9c378e6bd4a6a8c4e66c309a..e66af9659fdded5e5657a79edf15e87ae32353d6 100644 (file)
@@ -49,4 +49,4 @@ notice appear in supporting documentation.  No representations are made about
 the  suitability of fnord this software for any purpose.  It is provided "as
 is" without express or fnord implied warranty.
 .SH AUTHOR
-Jamie Zawinski <jwz@netscape.com>, 13-aug-92.
+Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
index fd03d1b671e92a1131fc2de066c618328c38337e..a4247784efec9973e8d6ce5f989de7a888fe5ffc 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 17fd7b664a331f1059a5db5d29641c783e1d73f2..0a45260d36b83e3b8c3eb8ade97b1fa24c8af0d9 100644 (file)
@@ -98,13 +98,13 @@ INCLUDES    = -I$(srcdir) -I.. @INCLUDES@
 
 SRCS           = alpha.c colors.c fade.c grabscreen.c hsv.c overlay.c \
                  resources.c spline.c usleep.c visual.c xmu.c xroger.c \
-                 yarandom.c erase.c sgivideo.c
+                 yarandom.c erase.c sgivideo.c xshm.c
 OBJS           = alpha.o colors.o fade.o grabscreen.o hsv.o overlay.o \
                  resources.o spline.o usleep.o visual.o xmu.o xroger.o \
-                 yarandom.o erase.o sgivideo.o
+                 yarandom.o erase.o sgivideo.o xshm.o
 HDRS           = alpha.h colors.h fade.h grabscreen.h hsv.h resources.h \
                  spline.h usleep.h utils.h version.h visual.h vroot.h xmu.h \
-                 yarandom.h erase.h sgivideo.h
+                 yarandom.h erase.h sgivideo.h xshm.h
 EXTRAS         = README Makefile.in ad2c
 VMSFILES       = compile_axp.com compile_decc.com vms-gtod.c vms-gtod.h \
                  vms-strdup.c
@@ -129,7 +129,7 @@ clean:
        -rm -f *.o a.out core
 
 distclean: clean
-       -rm -f config.h Makefile *~ "#"*
+       -rm -f Makefile TAGS *~ "#"*
 
 # Adds all current dependencies to Makefile
 depend:
@@ -198,6 +198,7 @@ distdepend:: compile_axp.com compile_decc.com
 ##############################################################################
 #
 # DO NOT DELETE: updated by make distdepend
+# $(srcdir)/DO $(srcdir)/NOT $(srcdir)/DELETE: $(srcdir)/updated $(srcdir)/by $(srcdir)/make $(srcdir)/distdepend
 
 alpha.o: $(srcdir)/utils.h
 alpha.o: ../config.h
@@ -259,5 +260,8 @@ sgivideo.o: ../config.h
 sgivideo.o: $(srcdir)/sgivideo.h
 sgivideo.o: $(srcdir)/resources.h
 sgivideo.o: $(srcdir)/visual.h
-sgivideo.o: $(srcdir)/usleep.h
+xshm.o: $(srcdir)/utils.h
+xshm.o: ../config.h
+xshm.o: $(srcdir)/xshm.h
+xshm.o: $(srcdir)/resources.h
 
index 0f55ca010530420086b72fd680cde026a0c0faba..1812cab0c7ab761551d8c4fc4888997568a13bf1 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index e16b3edb9ef0bd798bce8dff53d8d4f21b636eb9..1474367b5252b48592485cc3e4fcec68cd801c6c 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1995, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 096311624e207601682f6542056870d1171b86bb..b568a24dd11d9379b69034746bc1b855d3bc76ee 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 174c6bfd311bf2d5d6422b4262364dd31e1755ed..61421cf5c37f26b60071a423470e9aa5eb5ee47c 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index d22243d822c95fb0c5b556581bc0098194d223d1..357e75e56b2ddd14fe35012872759124b737fa80 100644 (file)
@@ -14,6 +14,7 @@ $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) VMS-GTOD.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) VMS-STRDUP.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XMU.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XROGER.C
+$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XSHM.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) YARANDOM.C
 $ lib/cre utils.olb_axp
 $ lib utils.olb_axp *.obj
index cd1792e6e7437b3daff17ee10932d07cfacb3232..0924953123fdf274060ed5245bda3ea4c20fc014 100644 (file)
@@ -14,6 +14,7 @@ $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) VMS-GTOD.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) VMS-STRDUP.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XMU.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XROGER.C
+$ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) XSHM.C
 $ CC/DECC/PREFIX=ALL/DEFINE=(VMS,HAVE_CONFIG_H)/INCL=([],[-]) YARANDOM.C
 $ lib/cre utils.olb_decc
 $ lib utils.olb_decc *.obj
index 874ed925c8d1a40e24dc9ecf7132ac68b640063e..9b58fa9a040f80713942754a628fb4ca1d7488cd 100644 (file)
@@ -289,6 +289,130 @@ squaretate (Display *dpy, Window window, GC gc,
 }
 
 
+/* from Frederick Roeber <roeber@netscape.com> */
+static void
+fizzle (Display *dpy, Window window, GC gc,
+           int width, int height, int delay, int granularity)
+{
+  /* These dimensions must be prime numbers.  They should be roughly the
+     square root of the width and height. */
+# define BX 31
+# define BY 31
+# define SIZE (BX*BY)
+
+  int array[SIZE];
+  int i, j;
+  XPoint *skews;
+  int nx, ny;
+
+  /* Distribute the numbers [0,SIZE) randomly in the array */
+  {
+    int indices[SIZE];
+
+    for( i = 0; i < SIZE; i++ ) {
+      array[i] = -1;
+      indices[i] = i;
+    } 
+
+    for( i = 0; i < SIZE; i++ ) {
+      j = random()%(SIZE-i);
+      array[indices[j]] = i;
+      indices[j] = indices[SIZE-i-1];
+    }
+  }
+
+  /* nx, ny are the number of cells across and down, rounded up */
+  nx = width  / BX + (0 == (width %BX) ? 0 : 1);
+  ny = height / BY + (0 == (height%BY) ? 0 : 1);
+  skews = (XPoint *)malloc(sizeof(XPoint) * (nx*ny));
+  if( (XPoint *)0 != skews ) {
+    for( i = 0; i < nx; i++ ) {
+      for( j = 0; j < ny; j++ ) {
+        skews[j * nx + i].x = random()%BX;
+        skews[j * nx + i].y = random()%BY;
+      }
+    }
+  }
+
+# define SKEWX(cx, cy) (((XPoint *)0 == skews)?0:skews[cy*nx + cx].x)
+# define SKEWY(cx, cy) (((XPoint *)0 == skews)?0:skews[cy*nx + cx].y)
+
+  for( i = 0; i < SIZE; i++ ) {
+    int x = array[i] % BX;
+    int y = array[i] / BX;
+
+    {
+      int iy, cy;
+      for( iy = 0, cy = 0; iy < height; iy += BY, cy++ ) {
+        int ix, cx;
+        for( ix = 0, cx = 0; ix < width; ix += BX, cx++ ) {
+          int xx = ix + (SKEWX(cx, cy) + x*((cx%(BX-1))+1))%BX;
+          int yy = iy + (SKEWY(cx, cy) + y*((cy%(BY-1))+1))%BY;
+          XDrawPoint(dpy, window, gc, xx, yy);
+        }
+      }
+    }
+
+    if( (BX-1) == (i%BX) ) {
+      XSync (dpy, False);
+      usleep (delay*granularity);
+    }
+  }
+
+# undef SKEWX
+# undef SKEWY
+
+  if( (XPoint *)0 != skews ) {
+    free(skews);
+  }
+
+# undef BX
+# undef BY
+# undef SIZE
+}
+
+
+#undef MAX
+#undef MIN
+#define MAX(a,b) ((a)>(b)?(a):(b))
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+/* from David Bagley <bagleyd@tux.org> */
+static void
+random_squares(Display * dpy, Window window, GC gc,
+               int width, int height, int delay, int granularity)
+{
+  int randsize = MAX(1, MIN(width, height) / (16 + (random() % 32)));
+  int max = (height / randsize + 1) * (width / randsize + 1);
+  int *squares = (int *) calloc(max, sizeof (*squares));
+  int i;
+  int columns = width / randsize + 1;  /* Add an extra for roundoff */
+
+  for (i = 0; i < max; i++)
+    squares[i] = i;
+
+  for (i = 0; i < max; i++)
+    {
+      int t, r;
+      t = squares[i];
+      r = random() % max;
+      squares[i] = squares[r];
+      squares[r] = t;
+    }
+
+  for (i = 0; i < max; i++)
+    {
+      XFillRectangle(dpy, window, gc,
+                    (squares[i] % columns) * randsize,
+                    (squares[i] / columns) * randsize,
+                    randsize, randsize);
+
+      XSync(dpy, False);
+      if (delay > 0 && ((i % granularity) == 0))
+      usleep(delay * granularity);
+    }
+  free(squares);
+}
 
 
 static Eraser erasers[] = {
@@ -299,6 +423,8 @@ static Eraser erasers[] = {
   circle_wipe,
   three_circle_wipe,
   squaretate,
+  fizzle,
+  random_squares,
 };
 
 
@@ -362,7 +488,7 @@ char *defaults [] = {
   0
 };
 
-XrmOptionDescRec options [] = {0};
+XrmOptionDescRec options [] = {{0}};
 int options_size = 0;
 
 void
index 9622c31e86b021f3dffbace03c188735481f6416..07b1a4e7d71484f1acd9a3089b43a3aa8cc6754e 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992-1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -518,8 +518,8 @@ sgi_gamma_fade (Display *dpy,
       for (screen = 0; screen < nscreens; screen++)
        {
          if (clear_windows)
-           XClearWindow (dpy, black_windows[i]);
-         XMapRaised (dpy, black_windows[i]);
+           XClearWindow (dpy, black_windows[screen]);
+         XMapRaised (dpy, black_windows[screen]);
        }
       XSync(dpy, False);
     }
index 5fd8c1879029314468a259f50a6d8b73c8dd8b47..bbe1c9bb0842064a33c76a83d8d39fc17e1f2b4d 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992-1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 6bf8cc8b848bdd8e6edd5ce57025a8642a6b44bb..7e4a37a3dc46b4a7018dc1f8965aa1ef2711d6f6 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 9c70eab82fe922c3ecedf9c1a244539bb20cdb86..6d2503a1fcf38c0a4179466954e58377737edfc0 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1993, 1994, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 027657c8686c3d3762b20d6ed3ce120ff3d22100..cf1cc8d18e27462e229061e7c967002a75bf23fc 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 6d9578a12072133854a313d2194c49115749cd7e..e0fdfb0fe60a8b9a204da7712069bbc52ffed6b0 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 0d82419b807b31d4b8b0845f9a52e6240c525612..c9faef8dda392e7b4afe15e0654d3b972cb7eedd 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 11e326ea819077755de41d9fd62edb46eeac83ab..b24a8ea07c7855a3364b5c83b3991e303a8113ad 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1997, 1998
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 6179565ee0a824147cb1a4f06dd86ff8c934ff6a..14ce1acb617b04f8fb9bc01c1029d12eb17e0f3c 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 13fb7a3c28e16a3cae6d78a6c86967ccacb3733b..9fc0b781eacdc53af22fb36349858bcd5a9d572f 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997, 1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 065350f6b34cee296d030a3b662887f679ae91b6..794fde6c841d08257758c03f9995e89e6e82b6f9 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 04a17aa788d846908078ba2f8c4bdfd2569cb932..706675910e1818736d0b61218427fb98719dc0d4 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1992, 1996, 1997
- *  Jamie Zawinski <jwz@netscape.com>
+ *  Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 6d58293de5ae4a7b271cb5712a4fcdca5a662d35..c40363ef4a09b48bc3f0619d0dd76116d4af5bf7 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992, 1996 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1992, 1996 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 2dbe47d916ff3ea65ab427df3790fb81d622f62b..284bb86dcd0ddaf27a775240984824100f1028f3 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 0dbdf7a5061db150ac462ca8fa56cdecf18fc2a1..5a328b056c49a4d156c2a399a64ebd951ea9ac6b 100644 (file)
@@ -1,2 +1,2 @@
 static const char screensaver_id[] =
-       "@(#)xscreensaver 2.24, by Jamie Zawinski (jwz@netscape.com)";
+       "@(#)xscreensaver 2.31 (02-Oct-98), by Jamie Zawinski (jwz@jwz.org)";
index 993db5aa4746f0c1d6f6aa7815a33d77ac863829..670ea0edb1b390608f834832c21f1412e5c02bd9 100644 (file)
@@ -1,5 +1,5 @@
 /* xscreensaver, Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
- *  by Jamie Zawinski <jwz@netscape.com>
+ *  by Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 68804b30e69c359ad0ce213f5cbeccf9ec4ce6f2..2a0b3534e691d1ffea812b3fc86ff86006338cf9 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1993-1998 by Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1993-1998 by Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 9773cd237f3ab38e7300135f2159d30d9a9bfff3..6cd6f465f0070fb058599b2c4e045c8fb8e495fb 100644 (file)
@@ -165,4 +165,12 @@ ERROR! Unsupported release of X11
     return 1;
 }
 
-#endif /* !HAVE_XMU */
+#else  /* HAVE_XMU */
+
+# ifdef __osf__
+  /* Stupid alpha 3.2 compiler returns a FAILURE exit code if compiling
+     an empty file.  Fake it out with a file-private variable. */
+  static const int digital_unix_compiler_sucks;
+# endif /* __osf__ */
+
+#endif /* HAVE_XMU */
index e64d28994707bda7fb9a6be1c9caed530a0b1fb0..adbf3aa4db04a53a930ebf05ef71a6d1298e3459 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1991-1998 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
diff --git a/utils/xshm.c b/utils/xshm.c
new file mode 100644 (file)
index 0000000..d37afa4
--- /dev/null
@@ -0,0 +1,134 @@
+/* xscreensaver, Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
+ *  by Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+/* The MIT-SHM (Shared Memory) extension is pretty tricky to use.
+   This file contains the common boiler-plate for creating a shared
+   XImage structure, and for making sure that the shared memory segments
+   get allocated and shut down cleanly.
+
+   This code currently deals only with shared XImages, not with shared Pixmaps.
+   It also doesn't use "completion events", but so far that doesn't seem to
+   be a problem (and I'm not entirely clear on when they would actually be
+   needed, anyway.)
+
+   If you don't have man pages for this extension, see
+   http://www.physik.uni-regensburg.de/~scs22156/sofie-0.2/mit-shm.html
+   or in the R6 sources as "xc/doc/specs/Xext/mit-shm.ms".
+
+   (This document seems not to ever remain available on the web in one place
+   for very long; you can search for it by the title, "MIT-SHM -- The MIT
+   Shared Memory Extension".)
+
+   To monitor the system's shared memory segments, run "ipcs -m".
+  */
+
+#include "utils.h"
+
+#ifdef HAVE_XSHM_EXTENSION     /* whole file */
+
+#include <errno.h>             /* for perror() */
+#include <X11/Xutil.h>         /* for XDestroyImage() */
+
+#include "xshm.h"
+#include "resources.h"         /* for get_string_resource() */
+
+
+extern char *progname;
+
+XImage *
+create_xshm_image (Display *dpy, Visual *visual,
+                  unsigned int depth,
+                  int format, char *data,
+                  XShmSegmentInfo *shm_info,
+                  unsigned int width, unsigned int height)
+{
+  XImage *image = 0;
+  if (!get_boolean_resource("useSHM", "Boolean"))
+    return 0;
+
+  if (!XShmQueryExtension (dpy))
+    return 0;
+
+  image = XShmCreateImage(dpy, visual, depth,
+                             format, data, shm_info, width, height);
+#ifdef DEBUG
+  fprintf(stderr, "\n%s: XShmCreateImage(... %d, %d)\n", progname,
+         width, height);
+#endif
+
+  shm_info->shmid = shmget(IPC_PRIVATE,
+                          image->bytes_per_line * image->height,
+                          IPC_CREAT | 0777);
+#ifdef DEBUG
+  fprintf(stderr, "%s: shmget(IPC_PRIVATE, %d, IPC_CREAT | 0777) ==> %d\n",
+         progname, image->bytes_per_line * image->height, shm_info->shmid);
+#endif
+
+  if (shm_info->shmid == -1)
+    {
+      char buf[1024];
+      sprintf (buf, "%s: shmget failed", progname);
+      perror(buf);
+      XDestroyImage (image);
+      image = 0;
+      XSync(dpy, False);
+    }
+  else
+    {
+      shm_info->readOnly = False;
+      image->data = shm_info->shmaddr = shmat(shm_info->shmid, 0, 0);
+
+#ifdef DEBUG
+      fprintf(stderr, "%s: shmat(%d, 0, 0) ==> %d\n", progname,
+             shm_info->shmid, (int) image->data);
+#endif
+
+      if (!XShmAttach(dpy, shm_info))
+       {
+         fprintf (stderr, "%s: XShmAttach failed!\n", progname);
+         XDestroyImage (image);
+         XSync(dpy, False);
+         shmdt (shm_info->shmaddr);
+         image = 0;
+       }
+
+#ifdef DEBUG
+      fprintf(stderr, "%s: XShmAttach(dpy, shm_info) ==> True\n", progname);
+#endif
+
+      XSync(dpy, False);
+
+      /* Delete the shared segment right now; the segment won't actually
+        go away until both the client and server have deleted it.  The
+        server will delete it as soon as the client disconnects, so we
+        should delete our side early in case of abnormal termination.
+        (And note that, in the context of xscreensaver, abnormal
+        termination is the rule rather than the exception, so this would
+        leak like a sieve if we didn't do this...)
+
+        #### Are we leaking anyway?  Perhaps because of the window of
+        opportunity between here and the XShmAttach call above, during
+        which we might be killed?  Do we need to establish a signal
+        handler for this case?
+       */
+      shmctl (shm_info->shmid, IPC_RMID, 0);
+
+#ifdef DEBUG
+      fprintf(stderr, "%s: shmctl(%d, IPC_RMID, 0)\n\n", progname,
+             shm_info->shmid);
+#endif
+    }
+
+  return image;
+}
+
+#endif /* HAVE_XSHM_EXTENSION */
diff --git a/utils/xshm.h b/utils/xshm.h
new file mode 100644 (file)
index 0000000..54e492e
--- /dev/null
@@ -0,0 +1,35 @@
+/* xscreensaver, Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998
+ *  by Jamie Zawinski <jwz@jwz.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.  No representations are made about the suitability of this
+ * software for any purpose.  It is provided "as is" without express or 
+ * implied warranty.
+ */
+
+/* The MIT-SHM (Shared Memory) extension is pretty tricky to use.
+   This file contains the common boiler-plate for creating a shared
+   XImage structure, and for making sure that the shared memory segments
+   get allocated and shut down cleanly.
+ */
+
+#ifndef __XSCREENSAVER_XSHM_H__
+
+#ifdef HAVE_XSHM_EXTENSION
+
+# include <sys/ipc.h>
+# include <sys/shm.h>
+# include <X11/extensions/XShm.h>
+
+extern XImage *create_xshm_image (Display *dpy, Visual *visual,
+                                 unsigned int depth,
+                                 int format, char *data,
+                                 XShmSegmentInfo *shm_info,
+                                 unsigned int width, unsigned int height);
+
+#endif /* HAVE_XSHM_EXTENSION */
+
+#endif /* __XSCREENSAVER_XSHM_H__ */
index 6563be7ed29ef2d41a090a9ed61caf0e5aa36edc..a77e34bfe7ddade1763bc4bea2fe88d9ef600a4c 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1997 by Jamie Zawinski <jwz@netscape.com>
+/* xscreensaver, Copyright (c) 1997 by Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
index 223a3011e3f66f4c3275f9f52fd13243298c7e88..4b16dc6affaf48c5f8febdf82478c2f3c24b3bb3 100644 (file)
@@ -1,22 +1,22 @@
 Begin3
 Title:          xscreensaver
-Version:        2.24
-Entered-date:   30JUN98
+Version:        2.31
+Entered-date:   02OCT98
 Description:    A modular screen saver and locker for the X Window System.
                 Highly customizable: allows the use of any program that
                 can draw on the root window as a display mode.
-                Comes with more than 60 display modes.
-                Home page: http://people.netscape.com/jwz/xscreensaver/
+                Comes with more than 80 display modes.
+                Home page: http://www.jwz.org/xscreensaver/
 Keywords:       screen saver, screen lock, lock, xlock, X11
-Author:         jwz@netscape.com (Jamie Zawinski)
-Maintained-by:  jwz@netscape.com (Jamie Zawinski)
+Author:         jwz@jwz.org (Jamie Zawinski)
+Maintained-by:  jwz@jwz.org (Jamie Zawinski)
 Primary-site:   ftp.x.org /contrib/applications/
-                831K xscreensaver-2.24.tar.gz
-                23K  xscreensaver.README
+                -rw-r--r--   1 jwz      jwz            20 Oct  2 17:33 xscreensaver-2.31.tar.gz xscreensaver-2.31.tar.gz
+                20K  xscreensaver.README
                 1K   xscreensaver.lsm
 Alternate-site: sunsite.unc.edu /pub/Linux/X11/screensavers/
-                831K xscreensaver-2.24.tar.gz
-                23K  xscreensaver.README
+                -rw-r--r--   1 jwz      jwz            20 Oct  2 17:33 xscreensaver-2.31.tar.gz xscreensaver-2.31.tar.gz
+                20K  xscreensaver.README
                 1K   xscreensaver.lsm
 Platforms:      Linux, Irix, SunOS, Solaris, HPUX, AIX, FreeBSD, NetBSD,
                 BSDI, SCO, OSF1, Ultrix, VMS.
index 2ae101381793ca8eb3de35e1577c21e05ba1aacd..52bf0a5c1afa0608c68fe3d723c2d780723458a7 100755 (executable)
@@ -28,11 +28,11 @@ Entered-date:   $DATE
 Description:    A modular screen saver and locker for the X Window System.
                 Highly customizable: allows the use of any program that
                 can draw on the root window as a display mode.
-                Comes with more than 60 display modes.
-                Home page: http://people.netscape.com/jwz/xscreensaver/
+                Comes with more than 80 display modes.
+                Home page: http://www.jwz.org/xscreensaver/
 Keywords:       screen saver, screen lock, lock, xlock, X11
-Author:         jwz@netscape.com (Jamie Zawinski)
-Maintained-by:  jwz@netscape.com (Jamie Zawinski)
+Author:         jwz@jwz.org (Jamie Zawinski)
+Maintained-by:  jwz@jwz.org (Jamie Zawinski)
 Primary-site:   ftp.x.org /contrib/applications/
                 $TAR_SIZE xscreensaver-$VERSION.tar.gz
                 $README_SIZE  xscreensaver.README