[Tux4kids-commits] r442 - in tuxtype/branches/tuxtype-reorg: . data data/images data/images/backgrounds data/images/cities data/images/comets data/images/hands data/images/icons data/images/keyboard data/images/menu data/images/status data/images/tux data/scripts data/sounds data/themes data/themes/armenian data/themes/armenian/images data/themes/bokmal data/themes/bokmal/images data/themes/bokmal/images/status data/themes/bokmal/words data/themes/brazilian-portuguese data/themes/brazilian-portuguese/images data/themes/brazilian-portuguese/words data/themes/catalan data/themes/catalan/words data/themes/czech data/themes/czech/words data/themes/dansk data/themes/dansk/sounds data/themes/dansk/words data/themes/deutsch data/themes/deutsch/words data/themes/espanol data/themes/espanol/images data/themes/espanol/words data/themes/euskara data/themes/euskara/images data/themes/euskara/words data/themes/french data/themes/french/words data/themes/greek data/themes/greek/words data/themes/italian data/themes/italian/words data/themes/jamaican data/themes/jamaican/images data/themes/jamaican/words data/themes/lithuanian data/themes/lithuanian/images data/themes/lithuanian/images/status data/themes/lithuanian/sounds data/themes/lithuanian/words data/themes/malayalam data/themes/malayalam/images data/themes/malayalam/images/keyboard data/themes/malayalam/images/status data/themes/malayalam/scripts data/themes/malayalam/words data/themes/nederlands data/themes/nederlands/words data/themes/nynorsk data/themes/nynorsk/images data/themes/nynorsk/images/status data/themes/nynorsk/words data/themes/russian data/themes/russian/images data/themes/russian/images/status data/themes/russian/words data/themes/svenska data/themes/svenska/words data/themes/swahili data/themes/swahili/words data/themes/wolof data/themes/wolof/images data/themes/wolof/words data/words doc doc/en src

dbruce-guest at alioth.debian.org dbruce-guest at alioth.debian.org
Wed Mar 26 11:29:19 UTC 2008


Author: dbruce-guest
Date: 2008-03-26 11:29:18 +0000 (Wed, 26 Mar 2008)
New Revision: 442

Added:
   tuxtype/branches/tuxtype-reorg/data/
   tuxtype/branches/tuxtype-reorg/data/phrases.txt
   tuxtype/branches/tuxtype-reorg/doc/en/
   tuxtype/branches/tuxtype-reorg/src/
   tuxtype/branches/tuxtype-reorg/src/ConvertUTF.c
   tuxtype/branches/tuxtype-reorg/src/ConvertUTF.h
   tuxtype/branches/tuxtype-reorg/src/Makefile.am
   tuxtype/branches/tuxtype-reorg/src/SDLMain.h
   tuxtype/branches/tuxtype-reorg/src/alphabet.c
   tuxtype/branches/tuxtype-reorg/src/audio.c
   tuxtype/branches/tuxtype-reorg/src/funcs.h
   tuxtype/branches/tuxtype-reorg/src/gettext.c
   tuxtype/branches/tuxtype-reorg/src/globals.h
   tuxtype/branches/tuxtype-reorg/src/laser.c
   tuxtype/branches/tuxtype-reorg/src/laser.h
   tuxtype/branches/tuxtype-reorg/src/loaders.c
   tuxtype/branches/tuxtype-reorg/src/main.c
   tuxtype/branches/tuxtype-reorg/src/options.c
   tuxtype/branches/tuxtype-reorg/src/pause.c
   tuxtype/branches/tuxtype-reorg/src/playgame.c
   tuxtype/branches/tuxtype-reorg/src/playgame.h
   tuxtype/branches/tuxtype-reorg/src/practice.c
   tuxtype/branches/tuxtype-reorg/src/scripting.c
   tuxtype/branches/tuxtype-reorg/src/scripting.h
   tuxtype/branches/tuxtype-reorg/src/setup.c
   tuxtype/branches/tuxtype-reorg/src/snow.c
   tuxtype/branches/tuxtype-reorg/src/snow.h
   tuxtype/branches/tuxtype-reorg/src/theme.c
   tuxtype/branches/tuxtype-reorg/src/titlescreen.c
   tuxtype/branches/tuxtype-reorg/src/titlescreen.h
Removed:
   tuxtype/branches/tuxtype-reorg/OFL.txt
   tuxtype/branches/tuxtype-reorg/tuxtype/
Modified:
   tuxtype/branches/tuxtype-reorg/Makefile.am
   tuxtype/branches/tuxtype-reorg/aclocal.m4
   tuxtype/branches/tuxtype-reorg/configure.ac
   tuxtype/branches/tuxtype-reorg/data/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/backgrounds/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/cities/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/comets/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/hands/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/icons/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/keyboard/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/menu/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/images/tux/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/scripts/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/sounds/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/armenian/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/armenian/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/bokmal/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/bokmal/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/catalan/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/catalan/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/czech/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/czech/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/dansk/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/dansk/sounds/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/dansk/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/deutsch/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/deutsch/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/espanol/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/espanol/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/espanol/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/euskara/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/euskara/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/euskara/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/french/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/french/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/greek/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/greek/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/italian/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/italian/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/jamaican/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/jamaican/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/jamaican/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/sounds/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/keyboard/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/scripts/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/malayalam/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nederlands/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nederlands/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/russian/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/russian/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/russian/images/status/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/russian/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/svenska/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/svenska/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/swahili/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/swahili/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/wolof/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/wolof/images/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/themes/wolof/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/data/words/Makefile.in
   tuxtype/branches/tuxtype-reorg/doc/Makefile.in
   tuxtype/branches/tuxtype-reorg/doc/en/Makefile.in
Log:
getting build to work in reorganized tree


Modified: tuxtype/branches/tuxtype-reorg/Makefile.am
===================================================================
--- tuxtype/branches/tuxtype-reorg/Makefile.am	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/Makefile.am	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,7 +1,7 @@
 # Modified to include support for NSIS Windows installer - David Bruce <dbruce at tampabay.rr.com>
 MAKENSIS=@NSIS@
 
-SUBDIRS = tuxtype doc
+SUBDIRS = data doc src
 
 EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL README TODO tuxtype.lsm tuxtype.spec tuxtype.spec.in config.h autorun.inf tuxtype.ico
 

Deleted: tuxtype/branches/tuxtype-reorg/OFL.txt
===================================================================
--- tuxtype/branches/tuxtype-reorg/OFL.txt	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/OFL.txt	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,97 +0,0 @@
-Copyright (c) <dates>, <Copyright Holder> (<URL|email>),
-with Reserved Font Name <Reserved Font Name>.
-Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>),
-with Reserved Font Name <additional Reserved Font Name>.
-Copyright (c) <dates>, <additional Copyright Holder> (<URL|email>).
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-http://scripts.sil.org/OFL
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded, 
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.

Modified: tuxtype/branches/tuxtype-reorg/aclocal.m4
===================================================================
--- tuxtype/branches/tuxtype-reorg/aclocal.m4	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/aclocal.m4	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -11,12 +11,15 @@
 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 # PARTICULAR PURPOSE.
 
-m4_if(m4_PACKAGE_VERSION, [2.61],,
-[m4_fatal([this file was generated for autoconf 2.61.
-You have another version of autoconf.  If you want to use that,
-you should regenerate the build system entirely.], [63])])
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61],,
+[m4_warning([this file was generated for autoconf 2.61.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
 
-# Copyright (C) 2002, 2003, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -31,7 +34,7 @@
 [am__api_version='1.10'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.10], [],
+m4_if([$1], [1.10.1], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -47,8 +50,10 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10])dnl
-_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)])
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -320,7 +325,7 @@
   # each Makefile.in and add a new line on top of each file to say so.
   # Grep'ing the whole file is not good either: AIX grep has a line
   # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
     dirpart=`AS_DIRNAME("$mf")`
   else
     continue
@@ -368,13 +373,13 @@
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006 Free Software Foundation, Inc.
+# 2005, 2006, 2008 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
+# serial 13
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -479,16 +484,17 @@
 # our stamp files there.
 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
 [# Compute $1's index in $config_headers.
+_am_arg=$1
 _am_stamp_count=1
 for _am_header in $config_headers :; do
   case $_am_header in
-    $1 | $1:* )
+    $_am_arg | $_am_arg:* )
       break ;;
     * )
       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
   esac
 done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
 
 # Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
 #
@@ -760,7 +766,7 @@
 
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
-# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in.
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
 

Modified: tuxtype/branches/tuxtype-reorg/configure.ac
===================================================================
--- tuxtype/branches/tuxtype-reorg/configure.ac	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/configure.ac	2008-03-26 11:29:18 UTC (rev 442)
@@ -5,7 +5,7 @@
 AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
-AC_CONFIG_SRCDIR([tuxtype/funcs.h])
+AC_CONFIG_SRCDIR([src/funcs.h])
 
 # Tell Automake not to be as strict about packaging standards for tuxtype
 # as it would be for an official Gnu program:
@@ -95,91 +95,91 @@
 
 
 # Sam's Install Kludge-work
-CPPFLAGS="$CPPFLAGS -DDATA_PREFIX=\\\"\$(prefix)\\\""
+# CPPFLAGS="$CPPFLAGS -DDATA_PREFIX=\\\"\$(prefix)\\\""
 
 AC_CONFIG_FILES([Makefile
+data/Makefile
+data/fonts/Makefile
+data/images/Makefile
+data/images/backgrounds/Makefile
+data/images/cities/Makefile
+data/images/comets/Makefile
+data/images/hands/Makefile
+data/images/icons/Makefile
+data/images/keyboard/Makefile
+data/images/menu/Makefile
+data/images/status/Makefile
+data/images/tux/Makefile
+data/scripts/Makefile
+data/sounds/Makefile
+data/themes/Makefile
+data/themes/armenian/Makefile
+data/themes/armenian/images/Makefile
+data/themes/bokmal/Makefile
+data/themes/bokmal/words/Makefile
+data/themes/bokmal/images/Makefile
+data/themes/bokmal/images/status/Makefile
+data/themes/brazilian-portuguese/Makefile
+data/themes/brazilian-portuguese/images/Makefile
+data/themes/brazilian-portuguese/words/Makefile
+data/themes/catalan/Makefile
+data/themes/catalan/words/Makefile
+data/themes/czech/Makefile
+data/themes/czech/words/Makefile
+data/themes/dansk/Makefile
+data/themes/dansk/sounds/Makefile
+data/themes/dansk/words/Makefile
+data/themes/deutsch/Makefile
+data/themes/deutsch/words/Makefile
+data/themes/espanol/Makefile
+data/themes/espanol/images/Makefile
+data/themes/espanol/words/Makefile
+data/themes/euskara/Makefile
+data/themes/euskara/images/Makefile
+data/themes/euskara/words/Makefile
+data/themes/french/Makefile
+data/themes/french/words/Makefile
+data/themes/greek/Makefile
+data/themes/greek/words/Makefile
+data/themes/italian/Makefile
+data/themes/italian/images/Makefile
+data/themes/italian/words/Makefile
+data/themes/jamaican/Makefile
+data/themes/jamaican/images/Makefile
+data/themes/jamaican/words/Makefile
+data/themes/lithuanian/Makefile
+data/themes/lithuanian/images/Makefile
+data/themes/lithuanian/images/status/Makefile
+data/themes/lithuanian/sounds/Makefile
+data/themes/lithuanian/words/Makefile
+data/themes/malayalam/Makefile
+data/themes/malayalam/images/Makefile
+data/themes/malayalam/images/status/Makefile
+data/themes/malayalam/images/keyboard/Makefile
+data/themes/malayalam/scripts/Makefile
+data/themes/malayalam/words/Makefile
+data/themes/nederlands/Makefile
+data/themes/nederlands/words/Makefile
+data/themes/nynorsk/Makefile
+data/themes/nynorsk/images/Makefile
+data/themes/nynorsk/images/status/Makefile
+data/themes/nynorsk/words/Makefile
+data/themes/russian/Makefile
+data/themes/russian/images/Makefile
+data/themes/russian/images/status/Makefile
+data/themes/russian/words/Makefile
+data/themes/svenska/Makefile
+data/themes/svenska/words/Makefile
+data/themes/swahili/Makefile
+data/themes/swahili/words/Makefile
+data/themes/wolof/Makefile
+data/themes/wolof/images/Makefile
+data/themes/wolof/words/Makefile
+data/words/Makefile
 doc/Makefile
-tuxtype/Makefile
-tuxtype/data/Makefile
-tuxtype/data/fonts/Makefile
-tuxtype/data/images/Makefile
-tuxtype/data/images/backgrounds/Makefile
-tuxtype/data/images/cities/Makefile
-tuxtype/data/images/comets/Makefile
-tuxtype/data/images/hands/Makefile
-tuxtype/data/images/icons/Makefile
-tuxtype/data/images/keyboard/Makefile
-tuxtype/data/images/menu/Makefile
-tuxtype/data/images/status/Makefile
-tuxtype/data/images/tux/Makefile
-tuxtype/data/scripts/Makefile
-tuxtype/data/sounds/Makefile
-tuxtype/data/themes/Makefile
-tuxtype/data/themes/armenian/Makefile
-tuxtype/data/themes/armenian/images/Makefile
-tuxtype/data/themes/bokmal/Makefile
-tuxtype/data/themes/bokmal/words/Makefile
-tuxtype/data/themes/bokmal/images/Makefile
-tuxtype/data/themes/bokmal/images/status/Makefile
-tuxtype/data/themes/brazilian-portuguese/Makefile
-tuxtype/data/themes/brazilian-portuguese/images/Makefile
-tuxtype/data/themes/brazilian-portuguese/words/Makefile
-tuxtype/data/themes/catalan/Makefile
-tuxtype/data/themes/catalan/words/Makefile
-tuxtype/data/themes/czech/Makefile
-tuxtype/data/themes/czech/words/Makefile
-tuxtype/data/themes/dansk/Makefile
-tuxtype/data/themes/dansk/sounds/Makefile
-tuxtype/data/themes/dansk/words/Makefile
-tuxtype/data/themes/deutsch/Makefile
-tuxtype/data/themes/deutsch/words/Makefile
-tuxtype/data/themes/espanol/Makefile
-tuxtype/data/themes/espanol/images/Makefile
-tuxtype/data/themes/espanol/words/Makefile
-tuxtype/data/themes/euskara/Makefile
-tuxtype/data/themes/euskara/images/Makefile
-tuxtype/data/themes/euskara/words/Makefile
-tuxtype/data/themes/french/Makefile
-tuxtype/data/themes/french/words/Makefile
-tuxtype/data/themes/greek/Makefile
-tuxtype/data/themes/greek/words/Makefile
-tuxtype/data/themes/italian/Makefile
-tuxtype/data/themes/italian/images/Makefile
-tuxtype/data/themes/italian/words/Makefile
-tuxtype/data/themes/jamaican/Makefile
-tuxtype/data/themes/jamaican/images/Makefile
-tuxtype/data/themes/jamaican/words/Makefile
-tuxtype/data/themes/lithuanian/Makefile
-tuxtype/data/themes/lithuanian/images/Makefile
-tuxtype/data/themes/lithuanian/images/status/Makefile
-tuxtype/data/themes/lithuanian/sounds/Makefile
-tuxtype/data/themes/lithuanian/words/Makefile
-tuxtype/data/themes/malayalam/Makefile
-tuxtype/data/themes/malayalam/images/Makefile
-tuxtype/data/themes/malayalam/images/status/Makefile
-tuxtype/data/themes/malayalam/images/keyboard/Makefile
-tuxtype/data/themes/malayalam/scripts/Makefile
-tuxtype/data/themes/malayalam/words/Makefile
-tuxtype/data/themes/nederlands/Makefile
-tuxtype/data/themes/nederlands/words/Makefile
-tuxtype/data/themes/nynorsk/Makefile
-tuxtype/data/themes/nynorsk/images/Makefile
-tuxtype/data/themes/nynorsk/images/status/Makefile
-tuxtype/data/themes/nynorsk/words/Makefile
-tuxtype/data/themes/russian/Makefile
-tuxtype/data/themes/russian/images/Makefile
-tuxtype/data/themes/russian/images/status/Makefile
-tuxtype/data/themes/russian/words/Makefile
-tuxtype/data/themes/svenska/Makefile
-tuxtype/data/themes/svenska/words/Makefile
-tuxtype/data/themes/swahili/Makefile
-tuxtype/data/themes/swahili/words/Makefile
-tuxtype/data/themes/wolof/Makefile
-tuxtype/data/themes/wolof/images/Makefile
-tuxtype/data/themes/wolof/words/Makefile
-tuxtype/data/words/Makefile
-tuxtype/docs/Makefile
-tuxtype/docs/en/Makefile
+doc/en/Makefile
+src/Makefile
+nsis/tuxtype.nsi
 tuxtype.spec])
 
 # Support for building NSIS Win32 installer (adapted from TuxMath NSIS):
@@ -199,10 +199,6 @@
 
 AC_PATH_PROG(NSIS, makensis, no, [$PATH])
 
-# FIXME should this go into earlier AC_CONFIG_FILES ?
-AC_CONFIG_FILES([
-nsis/tuxtype.nsi
-])
 
 AC_OUTPUT
 

Copied: tuxtype/branches/tuxtype-reorg/data (from rev 441, tuxtype/branches/tuxtype-reorg/tuxtype/data)

Modified: tuxtype/branches/tuxtype-reorg/data/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data
+subdir = data
 DIST_COMMON = $(dist_tuxtypedata_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/Makefile
+	  $(AUTOMAKE) --foreign  data/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images
+subdir = data/images
 DIST_COMMON = $(dist_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -248,9 +248,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/Makefile
+	  $(AUTOMAKE) --foreign  data/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -361,8 +361,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -387,8 +387,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -398,13 +398,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/images/backgrounds/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/backgrounds/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/backgrounds/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/backgrounds
+subdir = data/images/backgrounds
 DIST_COMMON = $(dist_images_backgrounds_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -179,9 +179,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/backgrounds/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/backgrounds/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/backgrounds/Makefile
+	  $(AUTOMAKE) --foreign  data/images/backgrounds/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/cities/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/cities/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/cities/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/cities
+subdir = data/images/cities
 DIST_COMMON = $(dist_images_cities_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -207,9 +207,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/cities/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/cities/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/cities/Makefile
+	  $(AUTOMAKE) --foreign  data/images/cities/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/comets/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/comets/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/comets/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -32,7 +32,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/comets
+subdir = data/images/comets
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -167,9 +167,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/comets/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/comets/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/comets/Makefile
+	  $(AUTOMAKE) --foreign  data/images/comets/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/hands/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/hands/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/hands/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -32,7 +32,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/hands
+subdir = data/images/hands
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -173,9 +173,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/hands/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/hands/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/hands/Makefile
+	  $(AUTOMAKE) --foreign  data/images/hands/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/icons/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/icons/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/icons/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/icons
+subdir = data/images/icons
 DIST_COMMON = $(dist_images_icons_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/icons/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/icons/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/icons/Makefile
+	  $(AUTOMAKE) --foreign  data/images/icons/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/keyboard/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/keyboard/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/keyboard/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/keyboard
+subdir = data/images/keyboard
 DIST_COMMON = $(dist_images_keyboard_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -182,9 +182,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/keyboard/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/keyboard/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/keyboard/Makefile
+	  $(AUTOMAKE) --foreign  data/images/keyboard/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/menu/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/menu/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/menu/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/menu
+subdir = data/images/menu
 DIST_COMMON = $(dist_images_menu_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -241,9 +241,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/menu/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/menu/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/menu/Makefile
+	  $(AUTOMAKE) --foreign  data/images/menu/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/status
+subdir = data/images/status
 DIST_COMMON = $(dist_images_status_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -181,9 +181,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/images/tux/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/images/tux/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/images/tux/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/images/tux
+subdir = data/images/tux
 DIST_COMMON = $(dist_images_tux_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -209,9 +209,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/images/tux/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/images/tux/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/images/tux/Makefile
+	  $(AUTOMAKE) --foreign  data/images/tux/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Copied: tuxtype/branches/tuxtype-reorg/data/phrases.txt (from rev 441, tuxtype/branches/tuxtype-reorg/tuxtype/phrases.txt)
===================================================================
--- tuxtype/branches/tuxtype-reorg/data/phrases.txt	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/data/phrases.txt	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,5 @@
+To all that believe in him he gave power to become children of God.
+Now is the time for all good men to come to the aid of their country.
+The quick brown fox jumps over the lazy dog.
+asdf jkl; asdf jkl; asdf jkl;
+AHHHH ha...

Modified: tuxtype/branches/tuxtype-reorg/data/scripts/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/scripts/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/scripts/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/scripts
+subdir = data/scripts
 DIST_COMMON = $(dist_scripts_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -181,9 +181,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/scripts/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/scripts/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/scripts/Makefile
+	  $(AUTOMAKE) --foreign  data/scripts/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/sounds/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/sounds/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/sounds/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/sounds
+subdir = data/sounds
 DIST_COMMON = $(dist_sounds_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -199,9 +199,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/sounds/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/sounds/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/sounds/Makefile
+	  $(AUTOMAKE) --foreign  data/sounds/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes
+subdir = data/themes
 DIST_COMMON = $(dist_themes_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -208,9 +208,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -321,8 +321,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -347,8 +347,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -358,13 +358,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/armenian/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/armenian/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/armenian/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/armenian
+subdir = data/themes/armenian
 DIST_COMMON = $(dist_themes_armenian_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/armenian/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/armenian/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/armenian/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/armenian/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/armenian/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/armenian/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/armenian/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/armenian/images
+subdir = data/themes/armenian/images
 DIST_COMMON = $(dist_themes_armenian_images_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/armenian/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/armenian/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/armenian/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/armenian/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/bokmal/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/bokmal/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/bokmal/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/bokmal
+subdir = data/themes/bokmal
 DIST_COMMON = $(dist_themes_bokmal_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/bokmal/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/bokmal/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/bokmal/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/bokmal/images
+subdir = data/themes/bokmal/images
 DIST_COMMON = $(dist_themes_bokmal_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/bokmal/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/bokmal/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/bokmal/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/bokmal/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/bokmal/images/status
+subdir = data/themes/bokmal/images/status
 DIST_COMMON = $(dist_themes_bokmal_images_status_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/bokmal/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/bokmal/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/bokmal/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/bokmal/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/bokmal/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/bokmal/words
+subdir = data/themes/bokmal/words
 DIST_COMMON = $(dist_themes_bokmal_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -183,9 +183,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/bokmal/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/bokmal/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/bokmal/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/brazilian-portuguese/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/brazilian-portuguese
+subdir = data/themes/brazilian-portuguese
 DIST_COMMON = $(dist_themes_brazilian_portuguese_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/brazilian-portuguese/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/brazilian-portuguese/images
+subdir = data/themes/brazilian-portuguese/images
 DIST_COMMON = $(dist_themes_brazilian_portuguese_images_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/brazilian-portuguese/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/brazilian-portuguese/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/brazilian-portuguese/words
+subdir = data/themes/brazilian-portuguese/words
 DIST_COMMON = $(dist_themes_brazilian_portuguese_words_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -179,9 +179,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/brazilian-portuguese/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/brazilian-portuguese/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/catalan/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/catalan/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/catalan/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/catalan
+subdir = data/themes/catalan
 DIST_COMMON = $(dist_themes_catalan_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/catalan/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/catalan/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/catalan/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/catalan/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/catalan/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/catalan/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/catalan/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/catalan/words
+subdir = data/themes/catalan/words
 DIST_COMMON = $(dist_themes_catalan_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -179,9 +179,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/catalan/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/catalan/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/catalan/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/catalan/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/czech/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/czech/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/czech/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/czech
+subdir = data/themes/czech
 DIST_COMMON = $(dist_themes_czech_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/czech/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/czech/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/czech/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/czech/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/czech/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/czech/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/czech/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/czech/words
+subdir = data/themes/czech/words
 DIST_COMMON = $(dist_themes_czech_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -181,9 +181,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/czech/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/czech/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/czech/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/czech/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/dansk/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/dansk/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/dansk/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/dansk
+subdir = data/themes/dansk
 DIST_COMMON = $(dist_themes_dansk_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/dansk/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/dansk/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/dansk/sounds/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/dansk/sounds/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/dansk/sounds/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/dansk/sounds
+subdir = data/themes/dansk/sounds
 DIST_COMMON = $(dist_themes_dansk_sounds_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/sounds/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/dansk/sounds/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/sounds/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/dansk/sounds/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/dansk/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/dansk/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/dansk/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/dansk/words
+subdir = data/themes/dansk/words
 DIST_COMMON = $(dist_themes_dansk_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -178,9 +178,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/dansk/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/dansk/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/dansk/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/deutsch/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/deutsch/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/deutsch/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/deutsch
+subdir = data/themes/deutsch
 DIST_COMMON = $(dist_themes_deutsch_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/deutsch/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/deutsch/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/deutsch/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/deutsch/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/deutsch/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/deutsch/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/deutsch/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/deutsch/words
+subdir = data/themes/deutsch/words
 DIST_COMMON = $(dist_themes_deutsch_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -180,9 +180,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/deutsch/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/deutsch/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/deutsch/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/deutsch/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/espanol/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/espanol/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/espanol/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/espanol
+subdir = data/themes/espanol
 DIST_COMMON = $(dist_themes_espanol_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/espanol/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/espanol/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/espanol/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/espanol/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/espanol/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/espanol/images
+subdir = data/themes/espanol/images
 DIST_COMMON = $(dist_themes_espanol_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/espanol/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/espanol/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/espanol/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/espanol/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/espanol/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/espanol/words
+subdir = data/themes/espanol/words
 DIST_COMMON = $(dist_themes_espanol_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/espanol/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/espanol/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/espanol/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/euskara/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/euskara/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/euskara/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/euskara
+subdir = data/themes/euskara
 DIST_COMMON = $(dist_themes_euskara_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/euskara/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/euskara/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/euskara/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/euskara/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/euskara/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/euskara/images
+subdir = data/themes/euskara/images
 DIST_COMMON = $(dist_themes_euskara_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/euskara/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/euskara/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/euskara/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/euskara/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/euskara/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/euskara/words
+subdir = data/themes/euskara/words
 DIST_COMMON = $(dist_themes_euskara_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/euskara/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/euskara/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/euskara/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/french/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/french/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/french/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/french
+subdir = data/themes/french
 DIST_COMMON = $(dist_themes_french_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/french/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/french/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/french/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/french/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/french/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/french/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/french/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/french/words
+subdir = data/themes/french/words
 DIST_COMMON = $(dist_themes_french_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -180,9 +180,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/french/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/french/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/french/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/french/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/greek/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/greek/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/greek/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/greek
+subdir = data/themes/greek
 DIST_COMMON = $(dist_themes_greek_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/greek/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/greek/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/greek/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/greek/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/greek/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/greek/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/greek/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/greek/words
+subdir = data/themes/greek/words
 DIST_COMMON = $(dist_themes_greek_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/greek/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/greek/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/greek/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/greek/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/italian/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/italian/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/italian/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/italian
+subdir = data/themes/italian
 DIST_COMMON = $(dist_themes_italian_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/italian/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/italian/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/italian/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/italian/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/italian/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/italian/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/italian/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/italian/words
+subdir = data/themes/italian/words
 DIST_COMMON = $(dist_themes_italian_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -185,9 +185,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/italian/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/italian/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/italian/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/italian/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/jamaican/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/jamaican/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/jamaican/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/jamaican
+subdir = data/themes/jamaican
 DIST_COMMON = $(dist_themes_jamaican_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/jamaican/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/jamaican/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/jamaican/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/jamaican/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/jamaican/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/jamaican/images
+subdir = data/themes/jamaican/images
 DIST_COMMON = $(dist_themes_jamaican_images_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -180,9 +180,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/jamaican/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/jamaican/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/jamaican/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/jamaican/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/jamaican/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/jamaican/words
+subdir = data/themes/jamaican/words
 DIST_COMMON = $(dist_themes_jamaican_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/jamaican/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/jamaican/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/jamaican/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/lithuanian/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/lithuanian
+subdir = data/themes/lithuanian
 DIST_COMMON = $(dist_themes_lithuanian_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/lithuanian/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/lithuanian/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/lithuanian/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -32,7 +32,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/lithuanian/images
+subdir = data/themes/lithuanian/images
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/lithuanian/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/lithuanian/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -270,8 +270,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -296,8 +296,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -307,13 +307,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/lithuanian/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/lithuanian/images/status
+subdir = data/themes/lithuanian/images/status
 DIST_COMMON = $(dist_themes_lithuanian_images_status_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/lithuanian/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/lithuanian/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/sounds/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/lithuanian/sounds/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/sounds/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/lithuanian/sounds
+subdir = data/themes/lithuanian/sounds
 DIST_COMMON = $(dist_themes_lithuanian_sounds_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/sounds/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/lithuanian/sounds/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/sounds/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/lithuanian/sounds/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/lithuanian/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/lithuanian/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/lithuanian/words
+subdir = data/themes/lithuanian/words
 DIST_COMMON = $(dist_themes_lithuanian_words_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -181,9 +181,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/lithuanian/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/lithuanian/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/lithuanian/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam
+subdir = data/themes/malayalam
 DIST_COMMON = $(dist_themes_malayalam_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -191,9 +191,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -304,8 +304,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -330,8 +330,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -341,13 +341,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam/images
+subdir = data/themes/malayalam/images
 DIST_COMMON = $(dist_themes_malayalam_images_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/keyboard/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/images/keyboard/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/keyboard/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam/images/keyboard
+subdir = data/themes/malayalam/images/keyboard
 DIST_COMMON = $(dist_themes_malayalam_images_keyboard_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/keyboard/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/images/keyboard/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/keyboard/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/images/keyboard/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam/images/status
+subdir = data/themes/malayalam/images/status
 DIST_COMMON = $(dist_themes_malayalam_images_status_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/scripts/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/scripts/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/scripts/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam/scripts
+subdir = data/themes/malayalam/scripts
 DIST_COMMON = $(dist_themes_malayalam_scripts_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -192,9 +192,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/scripts/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/scripts/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/scripts/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/scripts/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/malayalam/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/malayalam/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/malayalam/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/malayalam/words
+subdir = data/themes/malayalam/words
 DIST_COMMON = $(dist_themes_malayalam_words_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/malayalam/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/malayalam/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/malayalam/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nederlands/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nederlands/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nederlands/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nederlands
+subdir = data/themes/nederlands
 DIST_COMMON = $(dist_themes_nederlands_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nederlands/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nederlands/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nederlands/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nederlands/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nederlands/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nederlands/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nederlands/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nederlands/words
+subdir = data/themes/nederlands/words
 DIST_COMMON = $(dist_themes_nederlands_words_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -179,9 +179,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nederlands/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nederlands/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nederlands/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nederlands/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nynorsk/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nynorsk
+subdir = data/themes/nynorsk
 DIST_COMMON = $(dist_themes_nynorsk_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nynorsk/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nynorsk/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nynorsk/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nynorsk/images
+subdir = data/themes/nynorsk/images
 DIST_COMMON = $(dist_themes_nynorsk_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nynorsk/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nynorsk/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nynorsk/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nynorsk/images/status
+subdir = data/themes/nynorsk/images/status
 DIST_COMMON = $(dist_themes_nynorsk_images_status_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nynorsk/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nynorsk/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/nynorsk/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/nynorsk/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/nynorsk/words
+subdir = data/themes/nynorsk/words
 DIST_COMMON = $(dist_themes_nynorsk_images_words_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -183,9 +183,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/nynorsk/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/nynorsk/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/nynorsk/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/russian/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/russian/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/russian/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/russian
+subdir = data/themes/russian
 DIST_COMMON = $(dist_themes_russian_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/russian/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/russian/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/russian/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/russian/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/russian/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/russian/images
+subdir = data/themes/russian/images
 DIST_COMMON = $(dist_themes_russian_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -187,9 +187,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/russian/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/russian/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -300,8 +300,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -326,8 +326,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -337,13 +337,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/russian/images/status/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/russian/images/status/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/russian/images/status/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/russian/images/status
+subdir = data/themes/russian/images/status
 DIST_COMMON = $(dist_themes_russian_images_status_DATA) \
 	$(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/images/status/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/russian/images/status/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/images/status/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/russian/images/status/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/russian/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/russian/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/russian/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/russian/words
+subdir = data/themes/russian/words
 DIST_COMMON = $(dist_themes_russian_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/russian/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/russian/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/russian/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/svenska/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/svenska/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/svenska/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/svenska
+subdir = data/themes/svenska
 DIST_COMMON = $(dist_themes_svenska_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/svenska/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/svenska/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/svenska/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/svenska/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/svenska/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/svenska/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/svenska/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/svenska/words
+subdir = data/themes/svenska/words
 DIST_COMMON = $(dist_themes_svenska_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -177,9 +177,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/svenska/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/svenska/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/svenska/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/svenska/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/swahili/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/swahili/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/swahili/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/swahili
+subdir = data/themes/swahili
 DIST_COMMON = $(dist_themes_swahili_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -190,9 +190,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/swahili/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/swahili/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/swahili/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/swahili/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -303,8 +303,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -329,8 +329,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -340,13 +340,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/swahili/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/swahili/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/swahili/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/swahili/words
+subdir = data/themes/swahili/words
 DIST_COMMON = $(dist_themes_swahili_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -174,9 +174,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/swahili/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/swahili/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/swahili/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/swahili/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/wolof/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/wolof/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/wolof/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/wolof
+subdir = data/themes/wolof
 DIST_COMMON = $(dist_themes_wolof_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -189,9 +189,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/wolof/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/wolof/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -302,8 +302,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
 
@@ -328,8 +328,8 @@
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
 	  test -n "$$unique" || unique=$$empty_fix; \
 	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -339,13 +339,12 @@
 CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
 		$(TAGS_FILES) $(LISP)
 	tags=; \
-	here=`pwd`; \
 	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
 	unique=`for i in $$list; do \
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
-	  $(AWK) '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	test -z "$(CTAGS_ARGS)$$tags$$unique" \
 	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
 	     $$tags $$unique

Modified: tuxtype/branches/tuxtype-reorg/data/themes/wolof/images/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/wolof/images/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/wolof/images/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/wolof/images
+subdir = data/themes/wolof/images
 DIST_COMMON = $(dist_themes_wolof_images_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -176,9 +176,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/images/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/wolof/images/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/images/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/wolof/images/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/themes/wolof/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/themes/wolof/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/themes/wolof/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/themes/wolof/words
+subdir = data/themes/wolof/words
 DIST_COMMON = $(dist_themes_wolof_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -180,9 +180,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/themes/wolof/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/themes/wolof/words/Makefile
+	  $(AUTOMAKE) --foreign  data/themes/wolof/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/data/words/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/data/words/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/data/words/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/data/words
+subdir = data/words
 DIST_COMMON = $(dist_words_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -180,9 +180,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/data/words/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  data/words/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/data/words/Makefile
+	  $(AUTOMAKE) --foreign  data/words/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Modified: tuxtype/branches/tuxtype-reorg/doc/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/doc/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/doc/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.

Copied: tuxtype/branches/tuxtype-reorg/doc/en (from rev 441, tuxtype/branches/tuxtype-reorg/tuxtype/docs/en)

Modified: tuxtype/branches/tuxtype-reorg/doc/en/Makefile.in
===================================================================
--- tuxtype/branches/tuxtype-reorg/tuxtype/docs/en/Makefile.in	2008-03-25 19:59:20 UTC (rev 441)
+++ tuxtype/branches/tuxtype-reorg/doc/en/Makefile.in	2008-03-26 11:29:18 UTC (rev 442)
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10 from Makefile.am.
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -33,7 +33,7 @@
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
-subdir = tuxtype/docs/en
+subdir = doc/en
 DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -175,9 +175,9 @@
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  tuxtype/docs/en/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  doc/en/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --foreign  tuxtype/docs/en/Makefile
+	  $(AUTOMAKE) --foreign  doc/en/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \

Added: tuxtype/branches/tuxtype-reorg/src/ConvertUTF.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/ConvertUTF.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/ConvertUTF.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,539 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ * 
+ * Disclaimer
+ * 
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ * 
+ * Limitations on Rights to Redistribute This Code
+ * 
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+    Conversions between UTF32, UTF-16, and UTF-8. Source code file.
+    Author: Mark E. Davis, 1994.
+    Rev History: Rick McGowan, fixes & updates May 2001.
+    Sept 2001: fixed const & error conditions per
+	mods suggested by S. Parent & A. Lillich.
+    June 2002: Tim Dodd added detection and handling of incomplete
+	source sequences, enhanced error detection, added casts
+	to eliminate compiler warnings.
+    July 2003: slight mods to back out aggressive FFFE detection.
+    Jan 2004: updated switches in from-UTF8 conversions.
+    Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
+
+    See the header file "ConvertUTF.h" for complete documentation.
+
+------------------------------------------------------------------------ */
+
+
+#include "ConvertUTF.h"
+#ifdef CVTUTF_DEBUG
+#include <stdio.h>
+#endif
+
+static const int halfShift  = 10; /* used for shifting by 10 bits */
+
+static const UTF32 halfBase = 0x0010000UL;
+static const UTF32 halfMask = 0x3FFUL;
+
+#define UNI_SUR_HIGH_START  (UTF32)0xD800
+#define UNI_SUR_HIGH_END    (UTF32)0xDBFF
+#define UNI_SUR_LOW_START   (UTF32)0xDC00
+#define UNI_SUR_LOW_END     (UTF32)0xDFFF
+#define false	   0
+#define true	    1
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF16 (
+	const UTF32** sourceStart, const UTF32* sourceEnd, 
+	UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF32* source = *sourceStart;
+    UTF16* target = *targetStart;
+    while (source < sourceEnd) {
+	UTF32 ch;
+	if (target >= targetEnd) {
+	    result = targetExhausted; break;
+	}
+	ch = *source++;
+	if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+	    /* UTF-16 surrogate values are illegal in UTF-32; 0xffff or 0xfffe are both reserved values */
+	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+		if (flags == strictConversion) {
+		    --source; /* return to the illegal value itself */
+		    result = sourceIllegal;
+		    break;
+		} else {
+		    *target++ = UNI_REPLACEMENT_CHAR;
+		}
+	    } else {
+		*target++ = (UTF16)ch; /* normal case */
+	    }
+	} else if (ch > UNI_MAX_LEGAL_UTF32) {
+	    if (flags == strictConversion) {
+		result = sourceIllegal;
+	    } else {
+		*target++ = UNI_REPLACEMENT_CHAR;
+	    }
+	} else {
+	    /* target is a character in range 0xFFFF - 0x10FFFF. */
+	    if (target + 1 >= targetEnd) {
+		--source; /* Back up source pointer! */
+		result = targetExhausted; break;
+	    }
+	    ch -= halfBase;
+	    *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+	    *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+	}
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF32 (
+	const UTF16** sourceStart, const UTF16* sourceEnd, 
+	UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF16* source = *sourceStart;
+    UTF32* target = *targetStart;
+    UTF32 ch, ch2;
+    while (source < sourceEnd) {
+	const UTF16* oldSource = source; /*  In case we have to back up because of target overflow. */
+	ch = *source++;
+	/* If we have a surrogate pair, convert to UTF32 first. */
+	if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+	    /* If the 16 bits following the high surrogate are in the source buffer... */
+	    if (source < sourceEnd) {
+		ch2 = *source;
+		/* If it's a low surrogate, convert to UTF32. */
+		if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+		    ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+			+ (ch2 - UNI_SUR_LOW_START) + halfBase;
+		    ++source;
+		} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+		    --source; /* return to the illegal value itself */
+		    result = sourceIllegal;
+		    break;
+		}
+	    } else { /* We don't have the 16 bits following the high surrogate. */
+		--source; /* return to the high surrogate */
+		result = sourceExhausted;
+		break;
+	    }
+	} else if (flags == strictConversion) {
+	    /* UTF-16 surrogate values are illegal in UTF-32 */
+	    if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+		--source; /* return to the illegal value itself */
+		result = sourceIllegal;
+		break;
+	    }
+	}
+	if (target >= targetEnd) {
+	    source = oldSource; /* Back up source pointer! */
+	    result = targetExhausted; break;
+	}
+	*target++ = ch;
+    }
+    *sourceStart = source;
+    *targetStart = target;
+#ifdef CVTUTF_DEBUG
+if (result == sourceIllegal) {
+    fprintf(stderr, "ConvertUTF16toUTF32 illegal seq 0x%04x,%04x\n", ch, ch2);
+    fflush(stderr);
+}
+#endif
+    return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Index into the table below with the first byte of a UTF-8 sequence to
+ * get the number of trailing bytes that are supposed to follow it.
+ * Note that *legal* UTF-8 values can't have 4 or 5-bytes. The table is
+ * left as-is for anyone who may want to do such conversion, which was
+ * allowed in earlier algorithms.
+ */
+static const char trailingBytesForUTF8[256] = {
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+    2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+/*
+ * Magic values subtracted from a buffer value during UTF8 conversion.
+ * This table contains as many values as there might be trailing bytes
+ * in a UTF-8 sequence.
+ */
+static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL, 
+		     0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+
+/*
+ * Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
+ * into the first byte, depending on how many bytes follow.  There are
+ * as many entries in this table as there are UTF-8 sequence types.
+ * (I.e., one byte sequence, two byte... etc.). Remember that sequencs
+ * for *legal* UTF-8 will be 4 or fewer bytes total.
+ */
+static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+/* --------------------------------------------------------------------- */
+
+/* The interface converts a whole buffer to avoid function-call overhead.
+ * Constants have been gathered. Loops & conditionals have been removed as
+ * much as possible for efficiency, in favor of drop-through switches.
+ * (See "Note A" at the bottom of the file for equivalent code.)
+ * If your compiler supports it, the "isLegalUTF8" call can be turned
+ * into an inline function.
+ */
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF16toUTF8 (
+	const UTF16** sourceStart, const UTF16* sourceEnd, 
+	UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF16* source = *sourceStart;
+    UTF8* target = *targetStart;
+    while (source < sourceEnd) {
+	UTF32 ch;
+	unsigned short bytesToWrite = 0;
+	const UTF32 byteMask = 0xBF;
+	const UTF32 byteMark = 0x80; 
+	const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+	ch = *source++;
+	/* If we have a surrogate pair, convert to UTF32 first. */
+	if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+	    /* If the 16 bits following the high surrogate are in the source buffer... */
+	    if (source < sourceEnd) {
+		UTF32 ch2 = *source;
+		/* If it's a low surrogate, convert to UTF32. */
+		if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+		    ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+			+ (ch2 - UNI_SUR_LOW_START) + halfBase;
+		    ++source;
+		} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+		    --source; /* return to the illegal value itself */
+		    result = sourceIllegal;
+		    break;
+		}
+	    } else { /* We don't have the 16 bits following the high surrogate. */
+		--source; /* return to the high surrogate */
+		result = sourceExhausted;
+		break;
+	    }
+	} else if (flags == strictConversion) {
+	    /* UTF-16 surrogate values are illegal in UTF-32 */
+	    if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+		--source; /* return to the illegal value itself */
+		result = sourceIllegal;
+		break;
+	    }
+	}
+	/* Figure out how many bytes the result will require */
+	if (ch < (UTF32)0x80) {	     bytesToWrite = 1;
+	} else if (ch < (UTF32)0x800) {     bytesToWrite = 2;
+	} else if (ch < (UTF32)0x10000) {   bytesToWrite = 3;
+	} else if (ch < (UTF32)0x110000) {  bytesToWrite = 4;
+	} else {			    bytesToWrite = 3;
+					    ch = UNI_REPLACEMENT_CHAR;
+	}
+
+	target += bytesToWrite;
+	if (target > targetEnd) {
+	    source = oldSource; /* Back up source pointer! */
+	    target -= bytesToWrite; result = targetExhausted; break;
+	}
+	switch (bytesToWrite) { /* note: everything falls through. */
+	    case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 1: *--target =  (UTF8)(ch | firstByteMark[bytesToWrite]);
+	}
+	target += bytesToWrite;
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Utility routine to tell whether a sequence of bytes is legal UTF-8.
+ * This must be called with the length pre-determined by the first byte.
+ * If not calling this from ConvertUTF8to*, then the length can be set by:
+ *  length = trailingBytesForUTF8[*source]+1;
+ * and the sequence is illegal right away if there aren't that many bytes
+ * available.
+ * If presented with a length > 4, this returns false.  The Unicode
+ * definition of UTF-8 goes up to 4-byte sequences.
+ */
+
+static Boolean isLegalUTF8(const UTF8 *source, int length) {
+    UTF8 a;
+    const UTF8 *srcptr = source+length;
+    switch (length) {
+    default: return false;
+	/* Everything else falls through when "true"... */
+    case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+    case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
+    case 2: if ((a = (*--srcptr)) > 0xBF) return false;
+
+	switch (*source) {
+	    /* no fall-through in this inner switch */
+	    case 0xE0: if (a < 0xA0) return false; break;
+	    case 0xED: if (a > 0x9F) return false; break;
+	    case 0xF0: if (a < 0x90) return false; break;
+	    case 0xF4: if (a > 0x8F) return false; break;
+	    default:   if (a < 0x80) return false;
+	}
+
+    case 1: if (*source >= 0x80 && *source < 0xC2) return false;
+    }
+    if (*source > 0xF4) return false;
+    return true;
+}
+
+/* --------------------------------------------------------------------- */
+
+/*
+ * Exported function to return whether a UTF-8 sequence is legal or not.
+ * This is not used here; it's just exported.
+ */
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
+    int length = trailingBytesForUTF8[*source]+1;
+    if (source+length > sourceEnd) {
+	return false;
+    }
+    return isLegalUTF8(source, length);
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF16 (
+	const UTF8** sourceStart, const UTF8* sourceEnd, 
+	UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF8* source = *sourceStart;
+    UTF16* target = *targetStart;
+    while (source < sourceEnd) {
+	UTF32 ch = 0;
+	unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+	if (source + extraBytesToRead >= sourceEnd) {
+	    result = sourceExhausted; break;
+	}
+	/* Do this check whether lenient or strict */
+	if (! isLegalUTF8(source, extraBytesToRead+1)) {
+	    result = sourceIllegal;
+	    break;
+	}
+	/*
+	 * The cases all fall through. See "Note A" below.
+	 */
+	switch (extraBytesToRead) {
+	    case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+	    case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+	    case 3: ch += *source++; ch <<= 6;
+	    case 2: ch += *source++; ch <<= 6;
+	    case 1: ch += *source++; ch <<= 6;
+	    case 0: ch += *source++;
+	}
+	ch -= offsetsFromUTF8[extraBytesToRead];
+
+	if (target >= targetEnd) {
+	    source -= (extraBytesToRead+1); /* Back up source pointer! */
+	    result = targetExhausted; break;
+	}
+	if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+	    /* UTF-16 surrogate values are illegal in UTF-32 */
+	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+		if (flags == strictConversion) {
+		    source -= (extraBytesToRead+1); /* return to the illegal value itself */
+		    result = sourceIllegal;
+		    break;
+		} else {
+		    *target++ = UNI_REPLACEMENT_CHAR;
+		}
+	    } else {
+		*target++ = (UTF16)ch; /* normal case */
+	    }
+	} else if (ch > UNI_MAX_UTF16) {
+	    if (flags == strictConversion) {
+		result = sourceIllegal;
+		source -= (extraBytesToRead+1); /* return to the start */
+		break; /* Bail out; shouldn't continue */
+	    } else {
+		*target++ = UNI_REPLACEMENT_CHAR;
+	    }
+	} else {
+	    /* target is a character in range 0xFFFF - 0x10FFFF. */
+	    if (target + 1 >= targetEnd) {
+		source -= (extraBytesToRead+1); /* Back up source pointer! */
+		result = targetExhausted; break;
+	    }
+	    ch -= halfBase;
+	    *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+	    *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+	}
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF32toUTF8 (
+	const UTF32** sourceStart, const UTF32* sourceEnd, 
+	UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF32* source = *sourceStart;
+    UTF8* target = *targetStart;
+    while (source < sourceEnd) {
+	UTF32 ch;
+	unsigned short bytesToWrite = 0;
+	const UTF32 byteMask = 0xBF;
+	const UTF32 byteMark = 0x80; 
+	ch = *source++;
+	if (flags == strictConversion ) {
+	    /* UTF-16 surrogate values are illegal in UTF-32 */
+	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+		--source; /* return to the illegal value itself */
+		result = sourceIllegal;
+		break;
+	    }
+	}
+	/*
+	 * Figure out how many bytes the result will require. Turn any
+	 * illegally large UTF32 things (> Plane 17) into replacement chars.
+	 */
+	if (ch < (UTF32)0x80) {	     bytesToWrite = 1;
+	} else if (ch < (UTF32)0x800) {     bytesToWrite = 2;
+	} else if (ch < (UTF32)0x10000) {   bytesToWrite = 3;
+	} else if (ch <= UNI_MAX_LEGAL_UTF32) {  bytesToWrite = 4;
+	} else {			    bytesToWrite = 3;
+					    ch = UNI_REPLACEMENT_CHAR;
+					    result = sourceIllegal;
+	}
+	
+	target += bytesToWrite;
+	if (target > targetEnd) {
+	    --source; /* Back up source pointer! */
+	    target -= bytesToWrite; result = targetExhausted; break;
+	}
+	switch (bytesToWrite) { /* note: everything falls through. */
+	    case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+	    case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+	}
+	target += bytesToWrite;
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+/* --------------------------------------------------------------------- */
+
+ConversionResult ConvertUTF8toUTF32 (
+	const UTF8** sourceStart, const UTF8* sourceEnd, 
+	UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+    ConversionResult result = conversionOK;
+    const UTF8* source = *sourceStart;
+    UTF32* target = *targetStart;
+    while (source < sourceEnd) {
+	UTF32 ch = 0;
+	unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+	if (source + extraBytesToRead >= sourceEnd) {
+	    result = sourceExhausted; break;
+	}
+	/* Do this check whether lenient or strict */
+	if (! isLegalUTF8(source, extraBytesToRead+1)) {
+	    result = sourceIllegal;
+	    break;
+	}
+	/*
+	 * The cases all fall through. See "Note A" below.
+	 */
+	switch (extraBytesToRead) {
+	    case 5: ch += *source++; ch <<= 6;
+	    case 4: ch += *source++; ch <<= 6;
+	    case 3: ch += *source++; ch <<= 6;
+	    case 2: ch += *source++; ch <<= 6;
+	    case 1: ch += *source++; ch <<= 6;
+	    case 0: ch += *source++;
+	}
+	ch -= offsetsFromUTF8[extraBytesToRead];
+
+	if (target >= targetEnd) {
+	    source -= (extraBytesToRead+1); /* Back up the source pointer! */
+	    result = targetExhausted; break;
+	}
+	if (ch <= UNI_MAX_LEGAL_UTF32) {
+	    /*
+	     * UTF-16 surrogate values are illegal in UTF-32, and anything
+	     * over Plane 17 (> 0x10FFFF) is illegal.
+	     */
+	    if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+		if (flags == strictConversion) {
+		    source -= (extraBytesToRead+1); /* return to the illegal value itself */
+		    result = sourceIllegal;
+		    break;
+		} else {
+		    *target++ = UNI_REPLACEMENT_CHAR;
+		}
+	    } else {
+		*target++ = ch;
+	    }
+	} else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+	    result = sourceIllegal;
+	    *target++ = UNI_REPLACEMENT_CHAR;
+	}
+    }
+    *sourceStart = source;
+    *targetStart = target;
+    return result;
+}
+
+/* ---------------------------------------------------------------------
+
+    Note A.
+    The fall-through switches in UTF-8 reading code save a
+    temp variable, some decrements & conditionals.  The switches
+    are equivalent to the following loop:
+	{
+	    int tmpBytesToRead = extraBytesToRead+1;
+	    do {
+		ch += *source++;
+		--tmpBytesToRead;
+		if (tmpBytesToRead) ch <<= 6;
+	    } while (tmpBytesToRead > 0);
+	}
+    In UTF-8 writing code, the switches on "bytesToWrite" are
+    similarly unrolled loops.
+
+   --------------------------------------------------------------------- */

Added: tuxtype/branches/tuxtype-reorg/src/ConvertUTF.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/ConvertUTF.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/ConvertUTF.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2001-2004 Unicode, Inc.
+ * 
+ * Disclaimer
+ * 
+ * This source code is provided as is by Unicode, Inc. No claims are
+ * made as to fitness for any particular purpose. No warranties of any
+ * kind are expressed or implied. The recipient agrees to determine
+ * applicability of information provided. If this file has been
+ * purchased on magnetic or optical media from Unicode, Inc., the
+ * sole remedy for any claim will be exchange of defective media
+ * within 90 days of receipt.
+ * 
+ * Limitations on Rights to Redistribute This Code
+ * 
+ * Unicode, Inc. hereby grants the right to freely use the information
+ * supplied in this file in the creation of products supporting the
+ * Unicode Standard, and to make copies of this file in any form
+ * for internal or external distribution as long as this notice
+ * remains attached.
+ */
+
+/* ---------------------------------------------------------------------
+
+    Conversions between UTF32, UTF-16, and UTF-8.  Header file.
+
+    Several funtions are included here, forming a complete set of
+    conversions between the three formats.  UTF-7 is not included
+    here, but is handled in a separate source file.
+
+    Each of these routines takes pointers to input buffers and output
+    buffers.  The input buffers are const.
+
+    Each routine converts the text between *sourceStart and sourceEnd,
+    putting the result into the buffer between *targetStart and
+    targetEnd. Note: the end pointers are *after* the last item: e.g. 
+    *(sourceEnd - 1) is the last item.
+
+    The return result indicates whether the conversion was successful,
+    and if not, whether the problem was in the source or target buffers.
+    (Only the first encountered problem is indicated.)
+
+    After the conversion, *sourceStart and *targetStart are both
+    updated to point to the end of last text successfully converted in
+    the respective buffers.
+
+    Input parameters:
+	sourceStart - pointer to a pointer to the source buffer.
+		The contents of this are modified on return so that
+		it points at the next thing to be converted.
+	targetStart - similarly, pointer to pointer to the target buffer.
+	sourceEnd, targetEnd - respectively pointers to the ends of the
+		two buffers, for overflow checking only.
+
+    These conversion functions take a ConversionFlags argument. When this
+    flag is set to strict, both irregular sequences and isolated surrogates
+    will cause an error.  When the flag is set to lenient, both irregular
+    sequences and isolated surrogates are converted.
+
+    Whether the flag is strict or lenient, all illegal sequences will cause
+    an error return. This includes sequences such as: <F4 90 80 80>, <C0 80>,
+    or <A0> in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
+    must check for illegal sequences.
+
+    When the flag is set to lenient, characters over 0x10FFFF are converted
+    to the replacement character; otherwise (when the flag is set to strict)
+    they constitute an error.
+
+    Output parameters:
+	The value "sourceIllegal" is returned from some routines if the input
+	sequence is malformed.  When "sourceIllegal" is returned, the source
+	value will point to the illegal value that caused the problem. E.g.,
+	in UTF-8 when a sequence is malformed, it points to the start of the
+	malformed sequence.  
+
+    Author: Mark E. Davis, 1994.
+    Rev History: Rick McGowan, fixes & updates May 2001.
+		 Fixes & updates, Sept 2001.
+
+------------------------------------------------------------------------ */
+
+/* ---------------------------------------------------------------------
+    The following 4 definitions are compiler-specific.
+    The C standard does not guarantee that wchar_t has at least
+    16 bits, so wchar_t is no less portable than unsigned short!
+    All should be unsigned values to avoid sign extension during
+    bit mask & shift operations.
+------------------------------------------------------------------------ */
+
+typedef unsigned long	UTF32;	/* at least 32 bits */
+typedef unsigned short	UTF16;	/* at least 16 bits */
+typedef unsigned char	UTF8;	/* typically 8 bits */
+typedef unsigned char	Boolean; /* 0 or 1 */
+
+/* Some fundamental constants */
+#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define UNI_MAX_BMP (UTF32)0x0000FFFF
+#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
+#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
+#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+typedef enum {
+	conversionOK, 		/* conversion successful */
+	sourceExhausted,	/* partial character in source, but hit end */
+	targetExhausted,	/* insuff. room in target for conversion */
+	sourceIllegal		/* source sequence is illegal/malformed */
+} ConversionResult;
+
+typedef enum {
+	strictConversion = 0,
+	lenientConversion
+} ConversionFlags;
+
+/* This is for C++ and does no harm in C */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ConversionResult ConvertUTF8toUTF16 (
+		const UTF8** sourceStart, const UTF8* sourceEnd, 
+		UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF8 (
+		const UTF16** sourceStart, const UTF16* sourceEnd, 
+		UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+		
+ConversionResult ConvertUTF8toUTF32 (
+		const UTF8** sourceStart, const UTF8* sourceEnd, 
+		UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF8 (
+		const UTF32** sourceStart, const UTF32* sourceEnd, 
+		UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
+		
+ConversionResult ConvertUTF16toUTF32 (
+		const UTF16** sourceStart, const UTF16* sourceEnd, 
+		UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF16 (
+		const UTF32** sourceStart, const UTF32* sourceEnd, 
+		UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
+
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* --------------------------------------------------------------------- */

Added: tuxtype/branches/tuxtype-reorg/src/Makefile.am
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/Makefile.am	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/Makefile.am	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,30 @@
+## Process with Automake to create Makefile.in
+
+bin_PROGRAMS = tuxtype
+
+tuxtype_SOURCES = 	\
+	playgame.c	\
+	main.c		\
+	titlescreen.c	\
+	loaders.c	\
+	setup.c		\
+	laser.c		\
+	alphabet.c	\
+	theme.c		\
+	practice.c	\
+	audio.c		\
+	gettext.c	\
+	snow.c		\
+	scripting.c	\
+	pause.c		\
+	ConvertUTF.c	\
+	options.c
+
+EXTRA_DIST = titlescreen.h \
+	playgame.h 	\
+	laser.h		\
+	globals.h 	\
+	funcs.h 	\
+	scripting.h	\
+	snow.h		\
+	ConvertUTF.h

Added: tuxtype/branches/tuxtype-reorg/src/SDLMain.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/SDLMain.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/SDLMain.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,19 @@
+/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
+       Initial Version: Darrell Walisser <dwaliss1 at purdue.edu>
+       Non-NIB-Code & other changes: Max Horn <max at quendi.de>
+
+    Feel free to customize this file to suit your needs
+*/
+
+#import <Cocoa/Cocoa.h>
+
+ at interface SDLMain : NSObject
+{
+}
+- (IBAction)prefsMenu:(id)sender;
+- (IBAction)newGame:(id)sender;
+- (IBAction)openGame:(id)sender;
+- (IBAction)saveGame:(id)sender;
+- (IBAction)saveGameAs:(id)sender;
+- (IBAction)help:(id)sender;
+ at end


Property changes on: tuxtype/branches/tuxtype-reorg/src/SDLMain.h
___________________________________________________________________
Name: svn:executable
   + *

Added: tuxtype/branches/tuxtype-reorg/src/alphabet.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/alphabet.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/alphabet.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,1167 @@
+/***************************************************************************
+                          alphabet.c 
+ -  description: Init SDL
+                             -------------------
+    begin                : Jan 6 2003
+    copyright            : (C) 2003 by Jesse Andrews
+    email                : jdandr2 at tux4kids.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+
+/* Needed to handle rendering issues for Indic languages*/
+#ifndef WIN32
+#ifndef MACOSX
+#include <SDL_Pango.h>
+#endif
+#endif
+
+/* Needed to convert UTF-8 under Windows because we don't have glibc: */
+#include "ConvertUTF.h"  
+
+#include "globals.h"
+#include "funcs.h"
+
+
+/* NOTE these are externed in globals.h so not static */
+/* the colors we use throughout the game */
+SDL_Color black;
+SDL_Color gray;
+SDL_Color dark_blue;
+SDL_Color red;
+SDL_Color white;
+SDL_Color yellow;
+
+
+
+/* An individual item in the list of cached unicode characters that are rendered at   */
+/* the start of each game.                                                            */
+typedef struct uni_glyph {
+  wchar_t unicode_value;
+  SDL_Surface* white_glyph;
+  SDL_Surface* red_glyph;
+} uni_glyph;
+
+/* These are the arrays for the red and white letters: */
+static uni_glyph char_glyphs[MAX_UNICODES] = {0, NULL, NULL};
+
+/* An individual item in the list of unicode characters in the keyboard setup.   */
+/* Basically, just the Unicode value for the key and the finger used to type it. */
+typedef struct kbd_char {
+  wchar_t unicode_value;
+  char finger;
+} kbd_char;
+
+/* List with one entry for each typable character in keyboard setup - has the */
+/* Unicode value of the key and the associated fingering.                     */
+static kbd_char keyboard_list[MAX_UNICODES] = {0, -1};
+
+
+
+static TTF_Font* font = NULL;
+
+/* Used for word list functions (see below): */
+static int num_words;
+static wchar_t word_list[MAX_NUM_WORDS][MAX_WORD_SIZE + 1];
+static wchar_t char_list[MAX_UNICODES];  // List of distinct letters in word list
+static int num_chars_used = 0;       // Number of different letters in word list
+
+
+
+/* Local function prototypes: */
+static void gen_char_list(void);
+static int add_char(wchar_t uc);
+static void set_letters(unsigned char* t);
+static void show_letters(void);
+static void clear_keyboard(void);
+static int unicode_in_key_list(wchar_t uni_char);
+int check_needed_unicodes_str(const wchar_t* s);
+
+#ifndef WIN32
+#ifndef MACOSX
+static SDLPango_Matrix* SDL_Colour_to_SDLPango_Matrix(const SDL_Color* cl);
+#endif
+#endif
+
+
+
+/*****************************************************/
+/*                                                   */
+/*          "Public" Functions                       */
+/*                                                   */
+/*****************************************************/
+
+
+
+/* FIXME would be better to get keymap from system somehow (SDL? X11?) - */
+/* all this does now is fiddle with the ALPHABET and FINGER arrays */
+int LoadKeyboard(void)
+{
+  unsigned char fn[FNLEN];
+  int found = 0;
+
+  clear_keyboard();
+
+  /* First look for keyboard.lst in theme path, if desired: */
+  if (!settings.use_english)
+  {
+    sprintf(fn , "%s/keyboard.lst", settings.theme_data_path);
+    if (CheckFile(fn))
+    {
+      found = 1;
+    }
+  }
+
+  /* Now look in default path if desired or needed: */
+  if (!found)
+  {
+    sprintf(fn , "%s/keyboard.lst", settings.default_data_path);
+    if (CheckFile(fn))
+    {
+      found = 1;
+    }
+  }
+
+  if (!found)
+  {
+    fprintf(stderr, "LoadKeyboard(): Error finding file for keyboard setup!\n");
+    return 0;
+  }
+  
+  /* fn should now contain valid path to keyboard.lst: */
+  DEBUGCODE{fprintf(stderr, "fn = %s\n", fn);}
+
+  {
+    unsigned char str[255];
+    wchar_t wide_str[255];
+
+    FILE* f;
+    int i = 0, j = 0, k = 0;
+
+    f = fopen( fn, "r" );
+
+    if (f == NULL)
+    {
+      LOG("LoadKeyboard() - could not open keyboard.lst\n");
+      return 0;
+    }
+
+
+    do
+    {
+      fscanf( f, "%[^\n]\n", str);
+      /* Convert to wcs from UTF-8, if needed; */
+      //mbstowcs(wide_str, str, strlen(str) + 1);
+      ConvertFromUTF8(wide_str, str);
+
+      /* Line must have 3 chars (if more, rest are ignored) */
+      /* Format is: FINGER|Char  e.g   "3|d"                */
+      /* wide_str[0] == finger used to type char            */
+      /* wide_str[1] =='|'
+      /* wide_str[2] == Unicode value of character          */
+
+      /* FIXME - this might be a good place to use a    */
+      /* hash table to avoid n^2 performance problems.  */
+      /* Some sanity checks:  */
+      if ((wcslen(wide_str) >=3)
+       && (wcstol(&wide_str[0], NULL, 0) >=0)   /* These lines just make sure the */
+       && (wcstol(&wide_str[0], NULL, 0) < 10)  /* finger is between 0 and 10     */
+       && (wide_str[1] == '|')
+       && (k < MAX_UNICODES)
+       && !unicode_in_key_list(wide_str[2])) /* Make sure char not already added */
+      {
+        DEBUGCODE
+        {
+          fprintf(stderr, "Adding key: Unicode char = '%C'\tUnicode value = %d\tfinger = %d\n",
+                  wide_str[2], wide_str[2], wcstol(&wide_str[0], NULL, 0)); 
+        }
+
+        /* Just plug values into array: */
+        keyboard_list[k].unicode_value = wide_str[2];
+        keyboard_list[k].finger = wcstol(&wide_str[0], NULL, 0);
+        k++;
+      }
+    } while (!feof(f));
+
+
+    fclose(f);
+
+    LOG("Leaving LoadKeyboard()\n");
+    return 1;
+  }
+}
+
+/* Returns the finger hint(0-9) associated with a given Unicode value */
+/* in the keyboard_list:                                              */
+/* Returns -1 if somehow no finger associated with a Unicode value    */
+/* in the list (shouldn't happen).                                    */
+/* Returns -2 if Unicode value not in list.                           */
+int GetFinger(wchar_t uni_char)
+{
+  int i = 0;
+
+  while ((i < MAX_UNICODES)
+     &&  (keyboard_list[i].unicode_value != uni_char))
+  {
+    i++;
+  }
+
+  if (i == MAX_UNICODES)
+  {
+    fprintf(stderr, "GetFinger() - Unicode char '%C' not found in list.\n");
+    return -2;
+  }
+
+  if ((keyboard_list[i].finger < 0)
+   || (keyboard_list[i].finger > 9))
+  {
+    fprintf(stderr, "GetFinger() - Unicode char '%C' has no valid finger.\n");
+    return -1;
+  }  
+
+  return (int)keyboard_list[i].finger; /* Keep compiler from complaining */
+}
+
+
+
+int unicode_in_key_list(wchar_t uni_char)
+{
+  int i = 0;
+  while ((i < MAX_UNICODES)
+     &&  (keyboard_list[i].unicode_value != uni_char))
+  {
+    i++;
+  }
+  if (i == MAX_UNICODES)
+    return 0;
+  else
+    return 1;
+}
+
+/* NOTE if we can consistently use SDLPango on all platforms, we can simply */
+/* rename the pango version to BlackOutline() and get rid of this one.      */
+/* The input for this function should be UTF-8.                             */
+SDL_Surface* BlackOutline(const unsigned char* t, const TTF_Font* font, const SDL_Color* c)
+{
+  SDL_Surface* out = NULL;
+  SDL_Surface* black_letters = NULL;
+  SDL_Surface* white_letters = NULL;
+  SDL_Surface* bg = NULL;
+  SDL_Rect dstrect;
+  Uint32 color_key;
+
+  LOG("Entering BlackOutline()\n");
+
+/* Simply passthrough to SDLPango version if available (i.e. not under Windows):*/
+#ifndef WIN32
+#ifndef MACOSX
+return BlackOutline_SDLPango(t, font, c);
+#endif
+#endif
+
+
+  if (!t || !font || !c)
+  {
+    fprintf(stderr, "BlackOutline(): invalid ptr parameter, returning.");
+    return NULL;
+  }
+
+  black_letters = TTF_RenderUTF8_Blended((TTF_Font*)font, t, black);
+
+  if (!black_letters)
+  {
+    fprintf (stderr, "Warning - BlackOutline() could not create image for %s\n", t);
+    return NULL;
+  }
+
+  bg = SDL_CreateRGBSurface(SDL_SWSURFACE,
+                            (black_letters->w) + 5,
+                            (black_letters->h) + 5,
+                             32,
+                             RMASK, GMASK, BMASK, AMASK);
+  /* Use color key for eventual transparency: */
+  color_key = SDL_MapRGB(bg->format, 10, 10, 10);
+  SDL_FillRect(bg, NULL, color_key);
+
+  /* Now draw black outline/shadow 2 pixels on each side: */
+  dstrect.w = black_letters->w;
+  dstrect.h = black_letters->h;
+
+  /* NOTE: can make the "shadow" more or less pronounced by */
+  /* changing the parameters of these loops.                */
+  for (dstrect.x = 1; dstrect.x < 4; dstrect.x++)
+    for (dstrect.y = 1; dstrect.y < 3; dstrect.y++)
+      SDL_BlitSurface(black_letters , NULL, bg, &dstrect );
+
+  SDL_FreeSurface(black_letters);
+
+  /* --- Put the color version of the text on top! --- */
+  /* NOTE we cast away the 'const-ness' to keep compliler from complaining: */
+  white_letters = TTF_RenderUTF8_Blended((TTF_Font*)font, t, *c);
+  dstrect.x = 1;
+  dstrect.y = 1;
+  SDL_BlitSurface(white_letters, NULL, bg, &dstrect);
+  SDL_FreeSurface(white_letters);
+
+  /* --- Convert to the screen format for quicker blits --- */
+  SDL_SetColorKey(bg, SDL_SRCCOLORKEY|SDL_RLEACCEL, color_key);
+  out = SDL_DisplayFormatAlpha(bg);
+  SDL_FreeSurface(bg);
+
+  LOG("Leaving BlackOutline()\n");
+
+  return out;
+}
+
+
+
+#ifndef WIN32
+#ifndef MACOSX
+/*Convert SDL_Colour to SDLPango_Matrix*/
+
+SDLPango_Matrix* SDL_Colour_to_SDLPango_Matrix(const SDL_Color *cl)
+{
+  SDLPango_Matrix *colour;
+  colour=malloc(sizeof(SDLPango_Matrix));
+  int k;
+  for(k=0;k<4;k++){
+  	(*colour).m[0][k]=(*cl).r;
+  	(*colour).m[1][k]=(*cl).g;
+  	(*colour).m[2][k]=(*cl).b;
+  }
+  (*colour).m[3][0]=0;
+  (*colour).m[3][1]=255;
+  (*colour).m[3][2]=0;
+  (*colour).m[3][3]=0;
+
+  return colour;
+}
+
+
+
+/* This version basically uses the SDLPango lib instead of */
+/* TTF_RenderUTF*_Blended() to properly render Indic text. */
+SDL_Surface* BlackOutline_SDLPango(const unsigned char* t, const TTF_Font* font, const SDL_Color* c)
+{
+  SDL_Surface* out = NULL;
+  SDL_Surface* black_letters = NULL;
+  SDL_Surface* white_letters = NULL;
+  SDL_Surface* bg = NULL;
+  SDL_Rect dstrect;
+  Uint32 color_key;
+  /* To covert SDL_Colour to SDLPango_Matrix */
+  SDLPango_Matrix* colour = NULL;
+  /* Create a context which contains Pango objects.*/
+  SDLPango_Context* context = NULL;
+
+  LOG("\nEntering BlackOutline_SDLPango()\n");
+  DEBUGCODE{ fprintf(stderr, "will attempt to render: %s\n", t); }
+
+  if (!t || !font || !c)
+  {
+    fprintf(stderr, "BlackOutline_SDLPango(): invalid ptr parameter, returning.");
+    return NULL;
+  }
+
+  /* SDLPango crashes on 64 bit machines if passed empty string - Debian Bug#439071 */
+  if (*t == '\0')
+  {
+    fprintf(stderr, "BlackOutline_SDLPango(): empty string arg - must return to avoid segfault.");
+    return NULL;
+  }
+
+  colour = SDL_Colour_to_SDLPango_Matrix(c);
+  
+  /* Create the context */
+  context = SDLPango_CreateContext();	
+  SDLPango_SetDpi(context, 125.0, 125.0);
+  /* Set the color */
+  SDLPango_SetDefaultColor(context, MATRIX_TRANSPARENT_BACK_BLACK_LETTER );
+  SDLPango_SetBaseDirection(context, SDLPANGO_DIRECTION_LTR);
+  /* Set text to context */ 
+  SDLPango_SetMarkup(context, t, -1); 
+
+  if (!context)
+  {
+    fprintf (stderr, "In BlackOutline_SDLPango(), could not create context for %s", t);
+    return NULL;
+  }
+
+  black_letters = SDLPango_CreateSurfaceDraw(context);
+
+  if (!black_letters)
+  {
+    fprintf (stderr, "Warning - BlackOutline_SDLPango() could not create image for %s\n", t);
+    return NULL;
+  }
+
+  bg = SDL_CreateRGBSurface(SDL_SWSURFACE,
+                            (black_letters->w) + 5,
+                            (black_letters->h) + 5,
+                             32,
+                             RMASK, GMASK, BMASK, AMASK);
+  if (!bg)
+  {
+    fprintf (stderr, "Warning - BlackOutline()_SDLPango - bg creation failed\n");
+    SDL_FreeSurface(black_letters);
+    return NULL;
+  }
+
+  /* Draw text on a existing surface */
+  SDLPango_Draw(context, bg, 0, 0);
+
+  /* Use color key for eventual transparency: */
+  color_key = SDL_MapRGB(bg->format, 10, 10, 10);
+  SDL_FillRect(bg, NULL, color_key);
+
+  /* Now draw black outline/shadow 2 pixels on each side: */
+  dstrect.w = black_letters->w;
+  dstrect.h = black_letters->h;
+
+  /* NOTE: can make the "shadow" more or less pronounced by */
+  /* changing the parameters of these loops.                */
+  for (dstrect.x = 1; dstrect.x < 4; dstrect.x++)
+    for (dstrect.y = 1; dstrect.y < 3; dstrect.y++)
+      SDL_BlitSurface(black_letters , NULL, bg, &dstrect );
+
+  SDL_FreeSurface(black_letters);
+
+  /* --- Put the color version of the text on top! --- */
+  SDLPango_SetDefaultColor(context, colour);
+  white_letters = SDLPango_CreateSurfaceDraw(context);
+  dstrect.x = 1;
+  dstrect.y = 1;
+  SDL_BlitSurface(white_letters, NULL, bg, &dstrect);
+  SDL_FreeSurface(white_letters);
+
+  /* --- Convert to the screen format for quicker blits --- */
+  SDL_SetColorKey(bg, SDL_SRCCOLORKEY|SDL_RLEACCEL, color_key);
+  out = SDL_DisplayFormatAlpha(bg);
+  SDL_FreeSurface(bg);
+
+  LOG("Leaving BlackOutline_SDLPango()\n\n");
+
+  return out;
+}
+
+#endif
+#endif
+/* End of win32-excluded coded */
+
+
+
+
+/* This version takes a wide character string and renders it with the */
+/* Unicode string versions of the SDL_ttf functions:                  */
+SDL_Surface* BlackOutline_Unicode(const Uint16* t, const TTF_Font* font, const SDL_Color* c)
+{
+  SDL_Surface* out = NULL;
+  SDL_Surface* black_letters = NULL;
+  SDL_Surface* white_letters = NULL;
+  SDL_Surface* bg = NULL;
+  SDL_Rect dstrect;
+  Uint32 color_key;
+
+  if (!font || !c)
+  {
+    fprintf(stderr, "BlackOutline_wchar(): invalid ptr parameter, returning.");
+    return NULL;
+  }
+                                        /* (cast to stop compiler complaint) */
+  black_letters = TTF_RenderUNICODE_Blended((TTF_Font*)font, t, black);
+
+  if (!black_letters)
+  {
+    fprintf (stderr, "Warning - BlackOutline_wchar() could not create image for %S\n", t);
+    return NULL;
+  }
+
+  bg = SDL_CreateRGBSurface(SDL_SWSURFACE,
+                            (black_letters->w) + 5,
+                            (black_letters->h) + 5,
+                             32,
+                             RMASK, GMASK, BMASK, AMASK);
+  /* Use color key for eventual transparency: */
+  color_key = SDL_MapRGB(bg->format, 10, 10, 10);
+  SDL_FillRect(bg, NULL, color_key);
+
+  /* Now draw black outline/shadow 2 pixels on each side: */
+  dstrect.w = black_letters->w;
+  dstrect.h = black_letters->h;
+
+  /* NOTE: can make the "shadow" more or less pronounced by */
+  /* changing the parameters of these loops.                */
+  for (dstrect.x = 1; dstrect.x < 4; dstrect.x++)
+    for (dstrect.y = 1; dstrect.y < 3; dstrect.y++)
+      SDL_BlitSurface(black_letters , NULL, bg, &dstrect );
+
+  SDL_FreeSurface(black_letters);
+
+  /* --- Put the color version of the text on top! --- */
+                                       /* (cast to stop compiler complaint) */
+  white_letters = TTF_RenderUNICODE_Blended((TTF_Font*)font, t, *c);
+  dstrect.x = 1;
+  dstrect.y = 1;
+  SDL_BlitSurface(white_letters, NULL, bg, &dstrect);
+  SDL_FreeSurface(white_letters);
+
+  /* --- Convert to the screen format for quicker blits --- */
+  SDL_SetColorKey(bg, SDL_SRCCOLORKEY|SDL_RLEACCEL, color_key);
+  out = SDL_DisplayFormatAlpha(bg);
+  SDL_FreeSurface(bg);
+
+  return out;
+}
+
+
+/* FIXME dead code but could be useful*/
+static void show_letters(void)
+{
+	int i, l = 0;
+	SDL_Surface* abit;
+	SDL_Rect dst;
+	int stop = 0;
+	unsigned char t[255];
+
+	for (i=0; i<256; i++)
+		if (ALPHABET[i])
+			t[l++]=i;
+
+	t[l] = 0;
+
+	abit = BlackOutline(t, font, &white);
+
+	dst.x = 320 - (abit->w / 2);
+	dst.y = 275;
+	dst.w = abit->w;
+	dst.h = abit->h;
+
+	SDL_BlitSurface(abit, NULL, screen, &dst);
+
+	SDL_FreeSurface(abit);
+
+	abit = BlackOutline("Alphabet Set To:", font, &white);
+	dst.x = 320 - (abit->w / 2);
+	dst.y = 200;
+	dst.w = abit->w;
+	dst.h = abit->h;
+
+	SDL_BlitSurface(abit, NULL, screen, &dst);
+
+	SDL_UpdateRect(screen, 0, 0, 0 ,0);
+
+	while (!stop) 
+		while (SDL_PollEvent(&event)) 
+			switch (event.type) {
+				case SDL_QUIT:
+					exit(0);
+				case SDL_KEYDOWN:
+				case SDL_MOUSEBUTTONDOWN:
+					stop = 1;
+			}
+
+	SDL_FreeSurface(abit);
+}
+
+
+/* Returns a random Unicode char from the char_glyphs list: */
+/* --- get a letter --- */
+wchar_t GetRandLetter(void)
+{
+  static wchar_t last = -1; // we don't want to return same letter twice in a row
+  wchar_t letter;
+  int i = 0;
+
+  if (!num_chars_used)
+  {
+    fprintf(stderr, "GetRandLetter() - no letters in list!\n");
+    last = -1;
+    return -1;
+  }
+
+  do
+  {
+    i = rand() % num_chars_used;
+    letter = char_glyphs[i].unicode_value;
+  } while (letter == last);
+
+  last = letter;
+
+  return letter;
+}
+
+/******************************************************************************
+*                           WORD FILE & DATA STRUCTURE                        *
+******************************************************************************/
+
+
+
+/* ClearWordList: clears the number of words
+ */
+void ClearWordList(void)
+{
+  int i;
+  for (i = 0; i < num_words; i++)
+  {
+    word_list[i][0] = '\0';
+  }
+  num_words = 0;
+}
+
+/* FIXME need a better i18n-compatible way to do this: */
+/* UseAlphabet(): setups the word_list so that it really
+ * returns a LETTER when GetWord() is called
+ */
+// void UseAlphabet(void)
+// {
+// 	int i;
+// 
+// 	LOG("Entering UseAlphabet()\n");
+// 
+// 	num_words = 0;
+// 	/* This totally mucks up i18n abilities :( */
+// 	for (i=65; i<90; i++) 
+// 	{
+// 		//if (ALPHABET[i])
+//                 {
+// 			word_list[num_words][0] = (unsigned char)i;
+// 			word_list[num_words][1] = '\0';
+// 			num_words++;
+// 
+// 			DEBUGCODE { fprintf(stderr, "Adding %c\n", (unsigned char)i); }
+// 		}
+// 	}
+// 	/* Make sure list is terminated with null character */
+// 	word_list[num_words][0] = '\0';
+// 
+// 	/* Make list of all unicode characters used in word list: */
+// 	gen_char_list();
+// 
+// 	DOUT(num_words);
+// 	LOG("Leaving UseAlphabet()\n");
+// }
+
+/* GetWord: returns a random word that wasn't returned
+ * the previous time (unless there is only 1 word!!!)
+ */
+wchar_t* GetWord(void)
+{
+	static int last_choice = -1;
+	int choice;
+
+	LOG("Entering GetWord()\n");
+	DEBUGCODE { fprintf(stderr, "num_words is: %d\n", num_words); }
+
+	/* Now count list to make sure num_words is correct: */
+
+	num_words = 0;
+	while (word_list[num_words][0] != '\0')
+	{
+	  num_words++;
+	}
+
+	DEBUGCODE { fprintf(stderr, "After count, num_words is: %d\n", num_words); }
+
+        if (0 == num_words)
+	{
+	  LOG("No words in list\n");
+          return NULL;
+	}
+
+        if (num_words > MAX_NUM_WORDS)
+	{
+	  LOG("Error: num_words greater than array size\n");
+          return NULL;
+	}
+
+        if (num_words < 0)
+	{
+	  LOG("Error: num_words negative\n");
+          return NULL;
+	}
+
+	do {
+		choice = (rand() % num_words);
+	} while ((choice == last_choice) || (num_words < 2));
+
+	last_choice = choice;
+
+	/* NOTE need %S rather than %s because of wide characters */
+	DEBUGCODE { fprintf(stderr, "Selected word is: %S\n", word_list[choice]); }
+
+	return word_list[choice];
+}
+
+
+
+/* GenerateWordList(): adds the words from a given wordlist
+ * it ignores any words too long or that has bad
+ * character (such as #)
+ */
+
+/* Now returns the number of words in the list, so if no words */
+/* returns "false"                                             */
+int GenerateWordList(const char* wordFn)
+{
+  int j;
+  unsigned char temp_word[FNLEN];
+  wchar_t temp_wide_word[FNLEN];
+  size_t length;
+
+  FILE* wordFile=NULL;
+
+  DEBUGCODE { fprintf(stderr, "Entering GenerateWordList() for file: %s\n", wordFn); }
+
+  num_words = 0;
+
+  /* --- open the file --- */
+
+  wordFile = fopen( wordFn, "r" );
+
+  if ( wordFile == NULL )
+  {
+    fprintf(stderr, "ERROR: could not load wordlist: %s\n", wordFn );
+//    UseAlphabet( );
+    return 0;
+  }
+
+
+  /* --- load words from file named as argument: */
+
+  DEBUGCODE { fprintf(stderr, "WORD FILE OPENNED @ %s\n", wordFn); }
+
+  /* ignore the title (i.e. first line) */
+  fscanf( wordFile, "%[^\n]\n", temp_word);
+
+  while (!feof(wordFile) && (num_words < MAX_NUM_WORDS))
+  {
+    fscanf( wordFile, "%[^\n]\n", temp_word);
+    DEBUGCODE {fprintf(stderr, "temp_word = %s\n", temp_word);}
+
+    for (j = 0; j < strlen(temp_word); j++)
+    {
+      if (temp_word[j] == '\n' || temp_word[j] == '\r')
+        temp_word[j] = '\0';
+    }
+
+    /* Convert from UTF-8 to wcs and make sure word is usable: */
+    /* NOTE need to add one to length arg so terminating '\0' gets added: */
+    //length = mbstowcs(temp_wide_word, temp_word, strlen(temp_word) + 1);
+
+    length = ConvertFromUTF8(temp_wide_word, temp_word);
+    DOUT(length);
+
+    if (length == -1)  /* Means invalid UTF-8 sequence or conversion failed */
+    {
+      fprintf(stderr, "Word '%s' not added - invalid UTF-8 sequence!\n", temp_word);
+      continue;
+    }
+
+    if (length == 0)
+    {
+      fprintf(stderr, "Word '%ls' not added - length is zero\n", temp_wide_word);
+      continue;
+    }
+
+    if (length > MAX_WORD_SIZE)
+    {
+      fprintf(stderr, "Word '%s' not added - exceeds %d characters\n",
+              temp_word, MAX_WORD_SIZE);
+      continue;
+    }
+
+    if (num_words >= MAX_NUM_WORDS)
+    {
+      fprintf(stderr, "Word '%s' not added - list has reached max of %d characters\n",
+              temp_word, MAX_NUM_WORDS);
+      continue;
+    }
+
+    if (!check_needed_unicodes_str(temp_wide_word))
+    {
+      fprintf(stderr, "Word '%S' not added - contains Unicode chars not in keyboard list\n",
+              temp_wide_word);
+      continue;
+    }
+
+    /* If we make it to here, OK to add word: */
+    /* NOTE we have to add one to the length argument */
+    /* to include the terminating null.  */
+    DEBUGCODE
+    {
+      fprintf(stderr, "Adding word: %ls\n", temp_wide_word);
+    }
+
+    wcsncpy(word_list[num_words], temp_wide_word, strlen(temp_word) + 1);
+    num_words++;
+  }
+        
+  /* Make sure list is terminated with null character */
+  word_list[num_words][0] = '\0';
+
+  DOUT(num_words);
+
+//  if (num_words == 0)
+//    UseAlphabet( );
+
+  fclose(wordFile);
+
+  /* Make list of all unicode characters used in word list: */
+  /* (we use this to check to make sure all are "typable"); */
+  gen_char_list();
+
+  LOG("Leaving GenerateWordList()\n");
+
+  return (num_words);
+}
+
+
+
+
+
+
+/* This version creates the letters using TTF_RenderUNICODE_Blended */
+int RenderLetters(const TTF_Font* letter_font)
+{
+  Uint16 t[2];
+  int i, j;  /* i is chars attempted, j is chars actually rendered. */
+
+  if (!letter_font)
+  {
+    fprintf(stderr, "RenderLetters() - invalid TTF_Font* argument!\n");
+    return 0;
+  }
+
+  i = j = num_chars_used = 0;
+
+  t[1] = '\0';
+
+  while (i < MAX_UNICODES)
+  {
+    t[0] = keyboard_list[i].unicode_value;
+
+    if (t[0] != 0)
+    {
+      DEBUGCODE
+      {
+        fprintf(stderr, "Creating SDL_Surface for list element %d, char = '%lc', Unicode value = %d\n", i, *t, *t);
+      }
+
+      char_glyphs[j].unicode_value = t[0];
+      char_glyphs[j].white_glyph = BlackOutline_Unicode(t, letter_font, &white);
+      char_glyphs[j].red_glyph = BlackOutline_Unicode(t, letter_font, &red);
+
+      j++;
+      num_chars_used++;
+    }
+    i++;
+  }
+
+  return num_chars_used;
+}
+
+
+
+void FreeLetters(void)
+{
+  int i;
+
+  for (i = 0; i < num_chars_used; i++)
+  {
+    SDL_FreeSurface(char_glyphs[i].white_glyph);
+    SDL_FreeSurface(char_glyphs[i].red_glyph);
+    char_glyphs[i].unicode_value = 0;
+    char_glyphs[i].white_glyph = NULL;
+    char_glyphs[i].red_glyph = NULL;
+  } 
+  /* List now empty: */
+  num_chars_used = 0;
+}
+
+
+SDL_Surface* GetWhiteGlyph(wchar_t t)
+{
+  int i;
+
+  for (i = 0;
+       (char_glyphs[i].unicode_value != t) && (i <= num_chars_used);
+       i++)
+  {}
+
+  /* Now return appropriate pointer: */
+  if (i > num_chars_used)
+  {
+    /* Didn't find character: */
+    fprintf(stderr, "Could not find glyph for Unicode char '%C', value = %d\n", t, t);
+    return NULL;
+  }
+  
+  /* Return corresponding surface for blitting: */
+  return char_glyphs[i].white_glyph;
+}
+
+
+
+SDL_Surface* GetRedGlyph(wchar_t t)
+{
+  int i;
+
+  for (i = 0;
+       char_glyphs[i].unicode_value != t && i <= num_chars_used;
+       i++)
+  {}
+
+  /* Now return appropriate pointer: */
+  if (i > num_chars_used)
+  {
+    /* Didn't find character: */
+    fprintf(stderr, "Could not find glyph for unicode character %lc\n", t);
+    return NULL;
+  }
+  
+  /* Return corresponding surface for blitting: */
+  return char_glyphs[i].red_glyph;
+}
+
+
+/* Checks to see if all of the glyphs needed by the word list have been     */
+/* successfully rendered based on the Unicode values given in keyboard.lst. */
+/* If not, then the list contains characters that will not display and (if  */
+/* keyboard.lst is correct) cannot be typed. Most likely, this means that   */
+/* keyboard.lst is not correct.
+/* Returns 1 if all needed chars found, 0 otherwise.                        */
+int CheckNeededGlyphs(void)
+{
+  int i = 0;
+
+  while ((i < MAX_UNICODES)
+      && (char_list[i] != '\0'))
+  {
+    if (!GetWhiteGlyph(char_list[i]))
+    {
+      fprintf(stderr, "\nCheckNeededGlyphs() - needed char '%C' (Unicode value = %d) not found.\n",
+              char_list[i], char_list[i]);
+      fprintf(stderr, "This probably means that the theme's 'keyboard.lst' file is incorrect or incomplete.\n");
+      return 0;
+    }
+    i++;
+  }
+  LOG("CheckNeededGlyphs() - all chars found.\n");
+  return 1;
+}
+
+int check_needed_unicodes_str(const wchar_t* s)
+{
+  int i = 0;
+
+  while ((i < MAX_WORD_SIZE)
+      && (s[i] != '\0'))
+  {
+    if (!unicode_in_key_list(s[i]))
+    {
+      fprintf(stderr, "\ncheck_needed_unicodes_str() - needed char '%C' (Unicode value = %d) not found.\n",
+              s[i], s[i]);
+      return 0;
+    }
+    i++;
+  }
+  return 1;
+}
+
+/****************************************************/
+/*                                                  */
+/*       Local ("private") functions:               */
+/*                                                  */
+/****************************************************/
+
+
+/* Creates a list of distinct Unicode characters in */
+/* word_list[][] (so the program knows what         */
+/* needs to be rendered for the games)              */
+static void gen_char_list(void)
+{
+  int i, j;
+  i = j = 0;
+  char_list[0] = '\0';
+
+  while (word_list[i][0] != '\0' && i < MAX_NUM_WORDS) 
+  {
+    j = 0;
+
+    while (word_list[i][j]!= '\0' && j < MAX_WORD_SIZE)
+    {
+      add_char(word_list[i][j]);
+      j++;
+    }
+
+    i++;
+  }
+
+  DEBUGCODE
+  {
+    fprintf(stderr, "char_list = %S\n", char_list);
+  }
+}
+
+
+
+void ResetCharList(void)
+{
+  char_list[0] = '\0';
+}
+
+
+
+/* Creates a list of distinct Unicode characters in       */
+/* the argument string for subsequent rendering.          */
+/* Like gen_char_list() but takes a string argument       */
+/* instead of going through the currently selected        */
+/* word list. Argument should be UTF-8                    */
+/* Can be called multiple times on different strings      */
+/* to accumulate entire repertoire - call ResetCharList() */
+/* to start over                                          */
+void GenCharListFromString(const unsigned char* UTF8_str)
+{
+  int i = 0;
+  wchar_t wchar_buf[MAX_UNICODES];
+
+  ConvertFromUTF8(wchar_buf, UTF8_str);
+
+  /* FNLEN is max length of phrase (I think) */
+  while (wchar_buf[i] != '\0' && i < FNLEN) 
+  {
+    add_char(wchar_buf[i]);
+    i++;
+  }
+
+  DEBUGCODE
+  {
+    fprintf(stderr, "char_list = %S\n", char_list);
+  }
+}
+
+
+
+/* FIXME this function is currently dead code */
+/* --- setup the alphabet --- */
+static void set_letters(unsigned char *t) {
+	int i;
+
+	ALPHABET_SIZE = 0;
+	for (i=0; i<256; i++)
+		ALPHABET[i]=0;
+
+	for (i=0; i<strlen(t); i++)
+		if (t[i]!=' ') {
+			ALPHABET[(int)t[i]]=1;
+			ALPHABET_SIZE++;
+		}
+}
+
+
+
+/* Checks to see if the argument is already in the list and adds    */
+/* it if necessary.  Returns 1 if char added, 0 if already in list, */
+/* -1 if list already up to maximum size:                           */
+/* FIXME performance would be better with hashtable                 */
+static int add_char(wchar_t uc)
+{
+  int i = 0;
+  while ((char_list[i] != uc)
+      && (char_list[i] != '\0')
+      && (i < MAX_UNICODES - 1))          //Because 1 need for null terminator
+  {
+    i++;
+  }
+
+  /* unicode already in list: */
+  if (char_list[i] == uc)
+  {
+    DEBUGCODE{ fprintf(stderr,
+                       "Unicode value: %d\tcharacter %lc already in list\n",
+                        uc, uc);}
+    return 0;
+  }
+
+  if (char_list[i] == '\0')
+  {
+    DEBUGCODE{ fprintf(stderr, "Adding unicode value: %d\tcharacter %lc\n", uc, uc);}
+    char_list[i] = uc;
+    char_list[i + 1] = '\0';
+    return 1;
+  }
+
+  if (i == MAX_UNICODES - 1)            //Because 1 need for null terminator
+  {
+    LOG ("Unable to add unicode - list at max capacity");
+    return -1;
+  }
+}
+
+
+
+static void clear_keyboard(void)
+{
+  int i = 0;
+  for (i = 0; i < MAX_UNICODES; i++)
+  {
+    keyboard_list[i].unicode_value = 0;
+    keyboard_list[i].finger = -1;
+  }
+}
+
+
+/* This function just tidies up all the ptr args needed for      */
+/* ConvertUTF8toUTF32() from Unicode, Inc. into a neat wrapper.  */
+/* It returns -1 on error, otherwise returns the length of the   */
+/* converted, null-terminated wchar_t* string now stored in the  */
+/* location of the 'wide_word' pointer.                          */
+int ConvertFromUTF8(wchar_t* wide_word, const unsigned char* UTF8_word)
+{
+  int i = 0;
+  ConversionResult result;
+  UTF8 temp_UTF8[FNLEN];
+  UTF32 temp_UTF32[FNLEN];
+
+  const UTF8* UTF8_Start = temp_UTF8;
+  const UTF8* UTF8_End = &temp_UTF8[FNLEN-1];
+  UTF32* UTF32_Start = temp_UTF32;
+  UTF32* UTF32_End = &temp_UTF32[FNLEN-1];
+
+  strncpy(temp_UTF8, UTF8_word, FNLEN);
+
+  ConvertUTF8toUTF32(&UTF8_Start, UTF8_End,
+                     &UTF32_Start, UTF32_End, 0);
+
+  wide_word[0] = '\0';
+
+  while ((i < FNLEN) && (temp_UTF32[i] != '\0'))
+  {
+    wide_word[i] = temp_UTF32[i];
+    i++; 
+  }
+
+  if (i >= FNLEN)
+  {
+    fprintf(stderr, "convert_from_UTF8(): buffer overflow\n");
+    return -1;
+  }
+  else  //need terminating null:
+  {
+    wide_word[i] = '\0';
+  }
+
+  DEBUGCODE {fprintf(stderr, "wide_word = %ls\n", wide_word);}
+
+  return wcslen(wide_word);
+}
+
+

Added: tuxtype/branches/tuxtype-reorg/src/audio.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/audio.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/audio.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,66 @@
+/***************************************************************************
+ -  file: audio.c
+ -  description: this file contains audio related functions
+                            -------------------
+    begin                : Jan 22, 2003
+    copyright            : Sam Hart, Jesse Andrews (C) 2003
+    email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+static Mix_Music* defaultMusic = NULL; // holds music for audioMusicLoad/unload
+
+
+void PlaySound(Mix_Chunk* snd) {
+	if (!settings.sys_sound) return;
+
+	Mix_PlayChannel(-1, snd, 0);
+}
+
+/* MusicLoad attempts to load and play the music file 
+ * Note: loops == -1 means forever
+ */
+void MusicLoad(const char *musicFilename, int loops ) {
+	if (!settings.sys_sound) return;
+
+	MusicUnload(); // make sure defaultMusic is clear
+
+	defaultMusic = LoadMusic( musicFilename );
+	Mix_PlayMusic( defaultMusic, loops );
+}
+
+/* MusicUnload attempts to unload any music data that was
+ * loaded using the audioMusicLoad function
+ */
+void MusicUnload( void ) {
+	if (!settings.sys_sound) return;
+
+	if ( defaultMusic )
+		Mix_FreeMusic( defaultMusic );
+
+	defaultMusic = NULL;
+}
+
+/* audioMusicPlay attempts to play the passed music data. 
+ * if a music file was loaded using the audioMusicLoad
+ * it will be stopped and unloaded
+ * Note: loops == -1 means forever
+ */
+void MusicPlay(Mix_Music* musicData, int loops)
+{ 
+  if (!settings.sys_sound) return;
+  /* Stop previous music before playing new one: */
+  MusicUnload();	
+  Mix_PlayMusic(musicData, loops);
+}

Added: tuxtype/branches/tuxtype-reorg/src/funcs.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/funcs.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/funcs.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,122 @@
+/***************************************************************************
+                          funcs.h
+  description: function header
+                             -------------------
+    begin                : Sat May 6 2000
+    copyright            : (C) 2000 by Sam Hart
+    email                : hart at geekcomix.com
+ 
+  Modified by David Bruce
+  dbruce at tampabay.rr.com
+  2007
+
+***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+/* NOTE - there is no reason to declare functions using "extern", as all */
+/* non-local functions are visible throughout the program.               */ 
+
+
+/* In alphabet.c */
+SDL_Surface* BlackOutline(const unsigned char* t, const TTF_Font* font, const SDL_Color* c);
+SDL_Surface* BlackOutline_Unicode(const Uint16* t, const TTF_Font* font, const SDL_Color* c);
+
+#ifndef WIN32
+SDL_Surface* BlackOutline_SDLPango(const unsigned char* t, const TTF_Font* font, const SDL_Color* c);
+#endif
+
+/* (still in alphabet.c:) */
+int CheckNeededGlyphs(void);
+void ClearWordList(void);
+int ConvertFromUTF8(wchar_t* wide_word, const unsigned char* UTF8_word);
+void FreeLetters(void);
+int GenerateWordList(const char* wordFn);
+void GenCharListFromString(const unsigned char* UTF8_str);
+void ResetCharList(void);
+wchar_t GetLetter(void);
+wchar_t* GetWord(void);
+SDL_Surface* GetWhiteGlyph(wchar_t t);
+SDL_Surface* GetRedGlyph(wchar_t t);
+int LoadKeyboard(void);
+int GetFinger(wchar_t uni_char);
+int RenderLetters(const TTF_Font* letter_font);
+
+//void UseAlphabet(void);
+
+
+/* In audio.c:   */
+void PlaySound(Mix_Chunk* snd);
+void MusicLoad(const char* musicFilename, int repeatQty);
+void MusicUnload(void);
+void MusicPlay(Mix_Music* musicData, int repeatQty);
+
+
+/* In gettext.c:  */
+unsigned char* gettext(const unsigned char* in);
+int Load_PO_File(const char* file);
+
+
+/* In laser.c:        */
+int PlayLaserGame(int diff_level);
+
+
+/* In loaders.c: */
+int CheckFile(const char* file);
+sprite* FlipSprite(sprite* in, int X, int Y);
+void FreeSprite(sprite* gfx);
+TTF_Font* LoadFont(const char* fontfile, int fontsize);
+SDL_Surface* LoadImage(const char* datafile, int mode);
+void LoadLang(void);
+Mix_Music* LoadMusic(const char* datafile);
+Mix_Chunk* LoadSound(const char* datafile);
+sprite* LoadSprite(const char* name, int MODE);
+
+/* In options.c: */
+void Opts_Initialize(void);
+
+/* In pause.c: */
+int  Pause(void);
+int  inRect(SDL_Rect r, int x, int y);
+
+
+/* In playgame.c: */
+int PlayCascade(int level);
+void InitEngine(void);
+int TransWipe(SDL_Surface* newbkg, int type, int var1, int var2);
+
+
+/* In practice.c: */
+int Phrases(wchar_t* practice_phrase);
+
+
+/* In scripting.c: */
+int TestLesson(void);
+void ProjectInfo(void);
+void InstructCascade(void);
+void InstructLaser(void);
+
+
+/* In setup.c: */
+void GraphicsInit(Uint32 video_flags);
+void LibInit(Uint32 lib_flags);
+void LoadSettings(void);
+void SaveSettings(void);
+int SetupPaths(const char* theme_dir);
+void Cleanup(void);
+
+/* In theme.c: */
+void ChooseTheme(void);
+
+
+/* In titlescreen.c: */
+void SwitchScreenMode(void);
+void TitleScreen(void);
+

Added: tuxtype/branches/tuxtype-reorg/src/gettext.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/gettext.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/gettext.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,198 @@
+/***************************************************************************
+gettext.c 
+-  description: a crossplatform minimal gettext library
+-------------------
+begin                : Sunday Feb 23, 2003
+copyright            : (C) 2003 by Jesse Andrews
+email                : jdandr2 at uky.edu
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "stdio.h"
+#include "globals.h"
+
+/* we will store our list in a linked list since
+ * we don't expect too large of a list (famous last words!)
+ */
+
+/* FIXME not sure if this file's code is UTF-8/Unicode compatible DSB */
+
+struct node {
+	unsigned char *in;          // the english
+	unsigned char *out;         // the translation
+	struct node *next; // ptr to next in list, NULL if last
+};
+
+typedef struct node item; 
+
+static item* HEAD = NULL;
+
+/* Local function prototypes: */
+static void add_word(unsigned char* in, unsigned char* out);
+
+/* --- add a word to the linked list --- */
+
+void add_word(unsigned char* in, unsigned char* out) {
+	item* cur;
+	/* -- allocate space for the node in the list -- */
+	cur = (item *)malloc(sizeof(item));
+
+	/* -- allocate space for strings, and copy over -- */
+	cur->in = (unsigned char *)malloc(strlen(in)+2);
+	strncpy(cur->in, in, strlen(in)+1);
+	cur->out = (unsigned char *)malloc(strlen(out)+2);
+	strncpy(cur->out, out, strlen(out)+1);
+
+	/* -- add to the front of the list -- */
+	cur->next = HEAD;
+	HEAD = cur;
+}
+
+int Load_PO_File(const char* file) {
+	/* this function will load the passed file (a .po file)
+	 * if need be, it should erase any previously loaded
+	 * translations.
+	 *
+	 * the filename passed must exist!
+	 *
+	 * returns: 0 if ok
+	 * 	-1 if file could not be located
+	 * 	-2 if file has errors in it
+	 */
+
+	item* ptr;
+	FILE* f;
+	unsigned char str[FNLEN];
+	unsigned char in[FNLEN];
+	unsigned char out[FNLEN];
+
+	LOG( "Clearing previous translation list\n" );
+
+	while(HEAD != NULL) {
+		ptr = HEAD->next;
+		free(HEAD);
+		HEAD = ptr;
+	}
+
+	/* Yes, I know, I should use YACC/LEX
+	 * but, until you provide an GPL YACC/LEX 
+	 * implimentation on Mac OS _CLASSIC_, we have
+	 * to do things so they are portable, which
+	 * means, we have to parse our files by hand
+	 * using "state machines"
+	 */
+
+
+	LOG( "Loading translation file\n" );
+	f = fopen( file, "r" );
+
+	if (f == NULL)
+        {
+          DEBUGCODE
+          {
+            fprintf(stderr, "Load_PO_File() - could not open %s\n", file);
+          }
+          return -1;
+	}
+	/* ### ADD ERROR CHECKING ### */
+
+	do {
+		fscanf(f, "%[^\n]\n", str);
+
+		/* get rid of any comments! */
+		{
+			unsigned char mode='O';
+			int i;
+			for (i = 0; i < strlen(str); i++) {
+				if (mode == 'O') {
+					switch (str[i]) {
+						case '"': mode = 'I'; break;
+						case '#': str[i]='\0'; break;
+					}
+				} else {
+					switch (str[i]) {
+						case '\\': 
+							if (mode != 'S') mode = 'S';
+							else mode = 'I';
+							break;
+						case '"': 
+							if (mode != 'S') mode ='O'; 
+							break;
+						default:
+							mode = 'I'; // get rid of any /
+					}
+				}
+			}
+		}
+
+		/* we force msgid or msgstr to be at the begining of the line! */
+
+		if (strncmp(str, "msgid", 5) == 0) {
+			int start=0, endloc=0, i;
+			for (i=0; i<strlen(str); i++)
+				if (str[i] == '"') {
+					if (!start)
+						start = i;
+					else
+						endloc = i;
+				}
+			str[endloc]='\0';
+			strcpy(in, str+start+1);
+		}
+		if (strncmp(str, "msgstr", 6) == 0) {
+			int start=0,endloc=0, i;
+			for (i=0; i<strlen(str); i++)
+				if (str[i] == '"') {
+					if (!start)
+						start = i;
+					else
+						endloc = i;
+				}
+			str[endloc]='\0';
+			strcpy(out, str+start+1);
+			add_word(in, out);
+		}
+
+	} while( !feof(f) );
+
+	LOG( "Completed loading of translation file\n" );
+
+	return 0;
+}
+
+unsigned char* gettext(const unsigned char* in ) {
+	/* this function will attempt to translate the string
+	 * "in" to an "translation of in" if one exists.
+	 * if it doesn't exist in the translation set, it 
+	 * returns "in".
+	 */
+
+	/* go through each time until we find what we want...
+	 * if the number of translated words we use increases, 
+	 * we should move to a hash table.
+	 */
+
+	item* cur = HEAD;
+
+	if (settings.use_english)
+		// the cast is to keep the compiler from complaining
+                // about "discarded qualifiers"
+		return (unsigned char*)in;
+
+	while (cur != NULL) 
+		if (strcmp(cur->in, in) == 0)
+			return cur->out;
+		else
+			cur = cur->next;
+
+	/* if we didn't find anything return what we were asked */
+	return (unsigned char*)in;
+}

Added: tuxtype/branches/tuxtype-reorg/src/globals.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/globals.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/globals.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,235 @@
+/***************************************************************************
+                          globals.h
+  description: global varis
+                             -------------------
+    begin                : Fri May 5 2000
+    copyright            : (C) 2000 by Sam Hart
+    email                : hart at geekcomix.com
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#define to_upper(c) (((c) >= 'a' && (c) <= 'z') ? (c) -32 : (c))
+#define COL2RGB( col ) SDL_MapRGB( screen->format, col->r, col->g, col->b )
+
+#define FNLEN	200
+
+#define RES_X	640
+#define RES_Y	480
+#define BPP	16	
+
+#ifdef WIN32 
+#undef DATA_PREFIX
+#define DATA_PREFIX ".//"
+#endif
+
+#ifndef __GLOBALS_H__
+#define __GLOBALS_H__
+
+#define MAX_SPRITE_FRAMES 30
+
+#include <string.h>
+#include <wchar.h>
+#include <math.h>
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <locale.h>
+
+#include "../config.h"
+
+#include "SDL.h"
+#include "SDL_image.h"
+#include "SDL_mixer.h"
+#include "SDL_ttf.h"
+
+#endif //  __GLOBALS_H__
+
+#define NEXT_FRAME(SPRITE) if ((SPRITE)->num_frames) (SPRITE)->cur = (((SPRITE)->cur)+1) % (SPRITE)->num_frames;
+#define REWIND(SPRITE) (SPRITE)->cur = 0;
+
+#define MIN(x,y) ((x) < (y) ? (x) : (y))
+#define MAX(x,y) ((x) > (y) ? (x) : (y))
+
+/* Goal is to have all global settings here */
+/* (renamed from 'settings' to match tuxmath) */
+typedef struct game_option_type{
+  char default_data_path[FNLEN];
+  char theme_data_path[FNLEN];
+  char user_settings_path[FNLEN];
+  char global_settings_path[FNLEN];
+  char theme_name[FNLEN];
+  char lang[FNLEN];
+  char theme_font_name[FNLEN];
+  int use_english;
+  int fullscreen;
+  int sys_sound;
+  int sfx_volume;
+  int mus_volume;
+  int menu_music;
+  int menu_sound;
+  int speed_up;
+  int show_tux4kids;
+  int debug_on;
+  int o_lives;
+  int sound_vol;
+  int hidden; // Read the README file in the image directory for info on this ;)
+} game_option_type;
+
+/* Default values for game_option_type struct */
+/* They can be changed in the struct to other values at run-time */
+#define DEFAULT_MENU_FONT       "AndikaDesRevG.ttf"
+#define DEFAULT_GAME_FONT       "AndikaDesRevG.ttf" 
+#define DEFAULT_USE_ENGLISH 1
+#define DEFAULT_FULLSCREEN 1
+#define DEFAULT_SYS_SOUND 1
+#define DEFAULT_SFX_VOLUME 100
+#define DEFAULT_MUS_VOLUME 100
+#define DEFAULT_MENU_MUSIC 1
+#define DEFAULT_MENU_SOUND 1
+#define DEFAULT_SPEED_UP 0
+#define DEFAULT_SHOW_TUX4KIDS 1
+#define DEFAULT_DEBUG_ON 0
+#define DEFAULT_O_LIVES 0
+#define DEFAULT_SOUND_VOL 100
+#define DEFAULT_HIDDEN 0
+
+
+
+typedef struct {
+  SDL_Surface* frame[MAX_SPRITE_FRAMES];
+  SDL_Surface* default_img;
+  int num_frames;
+  int cur;
+} sprite;
+
+#define _(str) gettext (str)
+#define gettext_noop(str) (str)
+
+/* LOGGING works as such:
+ *
+ * - Use LOG if you want to output a string LOG( "Hello World");
+ *   
+ * - Use DOUT if you want to output a value of a variable and the
+ *   name of the variable gives enough context:
+ *   DOUT( specialCode );  would add to stderr: "specialCode = 1\n" or
+ *   whatever value specialCode had
+ *   
+ * - Use DEBUGCODE if you need to do something more complicated like
+ *   DEBUGCODE { fprintf(stderr, "examining letter %d\n", x); }
+ *   since DOUT(x) "x = 1\n" gives little information since x is used
+ *   all over the place!
+ */
+
+#define LOG( str ) if (settings.debug_on) fprintf( stderr, str );
+#define DEBUGCODE if (settings.debug_on) 
+#define DOUT(x) if (settings.debug_on) fprintf(stderr, "%s = %d\n", #x, x);
+
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+#define RMASK 0xff000000
+#define GMASK 0x00ff0000
+#define BMASK 0x0000ff00
+#define AMASK 0x000000ff
+#else
+#define RMASK 0x000000ff
+#define GMASK 0x0000ff00
+#define BMASK 0x00ff0000
+#define AMASK 0xff000000
+#endif
+
+
+
+#define MENU_FONT_SIZE	20
+#define GAME_FONT_SIZE	20
+
+/* Limits on word list size, word length, and on the number of distinct characters */
+/* that can be present within a word list: */
+#define MAX_NUM_WORDS   500
+#define MAX_WORD_SIZE   8
+#define MAX_UNICODES    1024
+
+#define WAIT_MS		2500
+#define	FRAMES_PER_SEC	50
+#define FULL_CIRCLE	140
+
+/* Menu Prototypes */
+enum Game_Type { 
+  QUIT_GAME, CASCADE, OPTIONS, LESSONS,
+  INSTRUCT_CASCADE, CASCADE1, CASCADE2, CASCADE3, CASCADE4,
+  INSTRUCT_LASER, LASER1, LASER2, LASER3, LASER4,
+  FREETYPE, ASDF, ALL, MAIN, SET_LANGUAGE, PROJECT_INFO, EDIT_WORDLIST,
+  LEVEL1, LEVEL2, LEVEL3, LEVEL4, LASER, INSTRUCT, NOT_CODED, NONE};
+
+/* Title sequence constants */
+#define PRE_ANIM_FRAMES	 10
+#define PRE_FRAME_MULT	 3
+#define MENU_SEP	 20
+
+
+#define IMG_REGULAR  0x01
+#define IMG_COLORKEY 0x02
+#define IMG_ALPHA    0x04
+#define IMG_MODES    0x07
+
+#define IMG_NOT_REQUIRED 0x10
+#define IMG_NO_THEME     0x20
+
+//Game difficulty levels
+enum { EASY, MEDIUM, HARD, INSANE, INF_PRACT };
+#define NUM_LEVELS  4
+
+extern game_option_type settings;
+
+/* FIXME get rid of as much global data as possible, esp. pointers */
+
+extern SDL_Surface* screen;
+//extern TTF_Font* font;
+extern SDL_Event  event;
+
+extern SDL_Color black;
+extern SDL_Color gray;
+extern SDL_Color dark_blue;
+extern SDL_Color red;
+extern SDL_Color white;
+extern SDL_Color yellow;
+
+extern SDL_Surface* letters[255]; /* Will be going away */
+
+/* These need some work to support Unicode & i18n: */
+extern wchar_t ALPHABET[256];
+extern int ALPHABET_SIZE;
+
+
+enum {
+	WIN_WAV,
+	BITE_WAV,
+	LOSE_WAV,
+	RUN_WAV,
+	SPLAT_WAV,
+	WINFINAL_WAV,
+	EXCUSEME_WAV,
+	PAUSE_WAV,
+	NUM_WAVES
+};
+
+#define MUSIC_FADE_OUT_MS	80
+
+enum {
+    WIPE_BLINDS_VERT,
+    WIPE_BLINDS_HORIZ,
+    WIPE_BLINDS_BOX,
+    RANDOM_WIPE,
+
+    NUM_WIPES
+};
+
+

Added: tuxtype/branches/tuxtype-reorg/src/laser.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/laser.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/laser.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,1080 @@
+/***************************************************************************
+ -  file: laser.c
+ -  description: a modification of TuxMath for typing :)
+                            -------------------
+    begin                : 
+    copyright            : Bill Kendrick (C) 2002
+                           Jesse Andrews (C) 2003
+    email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+#include "laser.h"
+
+
+#define FPS (1000 / 15)   /* 15 fps max */
+#define CITY_EXPL_START 3 * 5  /* Must be mult. of 5 (number of expl frames) */
+#define COMET_EXPL_START 2 * 2 /* Must be mult. of 2 (number of expl frames) */
+#define ANIM_FRAME_START 4 * 2 /* Must be mult. of 2 (number of tux frames) */
+#define GAMEOVER_COUNTER_START 75
+#define LEVEL_START_WAIT_START 20
+#define LASER_START 5
+#define NUM_ANS 8
+#define COMET_ZAP_FONT_SIZE 32
+
+/* Local (to laser.c) 'globals': */
+static sprite* shield = NULL;
+static SDL_Surface* images[NUM_IMAGES] = {NULL};
+static Mix_Chunk* sounds[NUM_SOUNDS] = {NULL};
+static Mix_Music* musics[NUM_MUSICS] = {NULL};
+static SDL_Surface* bkgd = NULL;
+static TTF_Font* font = NULL;
+
+static int wave, speed, score, pre_wave_score, num_attackers, distanceMoved;
+static wchar_t ans[NUM_ANS];
+static int ans_num;
+
+static comet_type comets[MAX_COMETS];
+static city_type cities[NUM_CITIES];
+static laser_type laser;
+
+/* Local function prototypes: */
+static void laser_add_comet(int diff_level);
+static void laser_add_score(int inc);
+static void laser_draw_console_image(int i);
+static void laser_draw_let(wchar_t c, int x, int y);
+static void laser_draw_line(int x1, int y1, int x2, int y2, int r, int g, int b);
+static void laser_draw_numbers(const unsigned char* str, int x);
+static void laser_load_data(void);
+static void laser_reset_level(int diff_level);
+static void laser_putpixel(SDL_Surface* surface, int x, int y, Uint32 pixel);
+static void laser_unload_data(void);
+
+/* --- MAIN GAME FUNCTION!!! --- */
+
+/* TODO modify game to allow longer words (12 chars or so) */
+
+int PlayLaserGame(int diff_level)
+{
+	int i, img, done, quit, frame, lowest, lowest_y, 
+	    tux_img, old_tux_img, tux_pressing, tux_anim, tux_anim_frame,
+	    tux_same_counter, level_start_wait, num_cities_alive,
+	    num_comets_alive, paused, picked_comet, 
+	    gameover;
+
+	Uint16 key_unicode;
+
+	SDL_Event event;
+	Uint32    last_time, now_time;
+	SDLKey    key;
+	SDL_Rect  src, dest;
+	/* str[] is a buffer to draw the scores, waves, etc. (don't need wchar_t) */
+	unsigned char str[64]; 
+
+	LOG( "starting Comet Zap game\n" );
+	DOUT( diff_level );
+
+	SDL_ShowCursor(0);
+	laser_load_data();
+
+	/* Clear window: */
+  
+	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+	SDL_Flip(screen);
+
+	/* --- MAIN GAME LOOP: --- */
+
+	done = 0;
+	quit = 0;
+  
+	/* Prepare to start the game: */
+  
+	wave = 1;
+	score = 0;
+	gameover = 0;
+	level_start_wait = LEVEL_START_WAIT_START;
+
+	
+	/* (Create and position cities) */
+  
+	for (i = 0; i < NUM_CITIES; i++) {
+		cities[i].alive = 1;
+		cities[i].expl = 0;
+		cities[i].shields = 1;
+
+		if (NUM_CITIES % 2 == 0) {
+			/* Left vs. Right - makes room for Tux and the console */
+
+			if (i < NUM_CITIES / 2) 
+				cities[i].x = (((screen->w / (NUM_CITIES + 1)) * i) + ((images[IMG_CITY_BLUE] -> w) / 2));
+			else
+				cities[i].x = (screen->w - ((((screen->w / (NUM_CITIES + 1)) * (i - (NUM_CITIES / 2)) + ((images[IMG_CITY_BLUE] -> w) / 2)))));
+		} else {
+			/* put them in order across the bottom of     *
+			 * the screen so we can do word's in order!!! */
+			cities[i].x = i*screen->w / (NUM_CITIES) + images[IMG_CITY_BLUE]->w/2;
+		}
+	}
+
+	num_cities_alive = NUM_CITIES;
+	num_comets_alive = 0;
+
+
+	/* (Clear laser) */
+
+	laser.alive = 0;
+
+  
+	/* Reset remaining stuff: */
+ 
+	bkgd = NULL;
+	laser_reset_level(diff_level);
+  
+	/* --- MAIN GAME LOOP!!! --- */
+  
+	frame = 0;
+	paused = 0;
+	picked_comet = -1;
+	tux_img = IMG_TUX_RELAX1;
+	tux_anim = -1;
+	tux_anim_frame = 0;
+	tux_same_counter = 0;
+	ans_num = 0;
+
+	MusicPlay(musics[MUS_GAME + (rand() % NUM_MUSICS)], 0);
+
+	do {
+
+		frame++;
+		last_time = SDL_GetTicks();
+
+		old_tux_img = tux_img;
+		tux_pressing = 0;
+
+		/* Handle any incoming events: */
+     
+		while (SDL_PollEvent(&event) > 0) {
+
+			if (event.type == SDL_QUIT) {
+				/* Window close event - quit! */
+				exit(0);
+	      
+			} else if (event.type == SDL_KEYDOWN) {
+
+				key = event.key.keysym.sym;
+				if (key == SDLK_F10) 
+					SwitchScreenMode();	      
+				if (key == SDLK_F11)
+					SDL_SaveBMP( screen, "laser.bmp");
+
+				if (key == SDLK_ESCAPE)
+					paused = 1;
+
+				/* --- eat other keys until level wait has passed --- */ 
+				if (level_start_wait > 0) 
+					key = SDLK_UNKNOWN;
+				
+				key_unicode = event.key.keysym.unicode;
+				//key_unicode = event.key.keysym.unicode & 0xff;
+
+				DEBUGCODE
+				{
+				  fprintf(stderr, "key_unicode = %d\n", key_unicode);
+				}
+
+				/* For now, tuxtype is case-insensitive for input, */
+                                /* with only uppercase for answers:                */
+                                if (key_unicode >= 97 && key_unicode <= 122)
+                                  key_unicode -= 32;  //convert lowercase to uppercase
+                                if (key_unicode >= 224 && key_unicode <= 255)
+                                  key_unicode -= 32; //same for non-US chars
+
+				LOG ("After checking for lower case:\n");
+				DEBUGCODE
+				{
+				  fprintf(stderr,
+                                   "key_unicode = %d\n", key_unicode);
+				}
+				/* Now update with case-folded value: */
+				ans[ans_num++] = key_unicode;
+
+			}
+		}
+      
+      
+		/* Handle answer: */
+
+		for (;ans_num>0;ans_num--) {
+
+			/*  Pick the lowest shootable comet which has the right answer: */
+	
+			lowest_y = 0;
+			lowest = -1;
+	
+			for (i = 0; i < MAX_COMETS; i++)
+				if (comets[i].alive
+				 && comets[i].shootable 
+				 && comets[i].expl == 0
+				 && comets[i].ch == ans[ans_num -1 ] 
+				 && comets[i].y > lowest_y)
+				{
+					lowest = i;
+					lowest_y = comets[i].y;
+				}
+	
+	
+			/* If there was an comet with this answer, destroy it! */
+	
+			if (lowest != -1) {
+
+				/* Destroy comet: */
+		  
+				comets[lowest].expl = COMET_EXPL_START;
+				/* Make next letter in word shootable: */
+				comets[lowest].shootable = 0;
+                                if (comets[lowest].next)
+                                  comets[lowest].next->shootable = 1;
+
+				/* Fire laser: */
+				laser.alive = LASER_START;
+
+				/* this is a hack so drawing to the center of the screen works */
+				if (abs(comets[lowest].x - screen->w/2) < 10) {
+					laser.x1 = screen->w / 2;
+					laser.y1 = screen->h;
+	    
+					laser.x2 = laser.x1;
+					laser.y2 = comets[lowest].y;
+				} else {
+					laser.x1 = screen->w / 2;
+					laser.y1 = screen->h;
+	    
+					laser.x2 = comets[lowest].x;
+					laser.y2 = comets[lowest].y;
+				}
+	    
+				PlaySound(sounds[SND_LASER]);
+	    
+				/* 50% of the time.. */
+	    
+				if (0 == (rand() % 2))  {
+
+					/* ... pick an animation to play: */ 
+					if (0 == (rand() % 2))
+						tux_anim = IMG_TUX_YES1;
+					else
+						tux_anim = IMG_TUX_YAY1;
+	        
+					tux_anim_frame = ANIM_FRAME_START;
+				}
+
+				/* Increment score: */
+
+				laser_add_score( (diff_level+1) * 5 * ((screen->h - comets[lowest].y)/20 ));
+
+			} else {
+
+				/* Didn't hit anything! */
+	    
+				PlaySound(sounds[SND_BUZZ]);
+	    
+				if (0 == (rand() % 2))
+					tux_img = IMG_TUX_DRAT;
+				else
+					tux_img = IMG_TUX_YIPE;
+
+				laser_add_score( -25 * wave);
+			}
+		}
+
+      
+		/* Handle start-wait countdown: */
+      
+		if (level_start_wait > 0) {
+
+			level_start_wait--;
+	  
+			if (level_start_wait > LEVEL_START_WAIT_START / 4)
+				tux_img = IMG_TUX_RELAX1;
+			else if (level_start_wait > 0)
+				tux_img = IMG_TUX_RELAX2;
+			else
+				tux_img = IMG_TUX_SIT;
+	  
+			if (level_start_wait == LEVEL_START_WAIT_START / 4)
+				PlaySound(sounds[SND_ALARM]);
+		}
+
+      
+		/* If Tux pressed a button, pick a new (different!) stance: */
+	  
+		if (tux_pressing) {
+			while (tux_img == old_tux_img)
+				tux_img = IMG_TUX_CONSOLE1 + (rand() % 3);
+
+			playsound(sounds[SND_CLICK]);
+		}
+      
+      
+		/* If Tux is being animated, show the animation: */
+
+		if (tux_anim != -1) {
+			tux_anim_frame--;
+
+			if (tux_anim_frame < 0)
+				tux_anim = -1;
+			else
+				tux_img = tux_anim + 1 - (tux_anim_frame / (ANIM_FRAME_START / 2));
+		}
+
+
+		/* Reset Tux to sitting if he's been doing nothing for a while: */
+
+		if (old_tux_img == tux_img) {
+			tux_same_counter++;
+
+			if (tux_same_counter >= 20)
+				old_tux_img = tux_img = IMG_TUX_SIT;
+			if (tux_same_counter >= 60)
+				old_tux_img = tux_img = IMG_TUX_RELAX1;
+		} else
+			tux_same_counter = 0;
+
+
+		/* Handle comets: */
+     
+		num_comets_alive = 0;
+
+		distanceMoved += speed;
+      
+		for (i = 0; i < MAX_COMETS; i++) {
+			if (comets[i].alive) {
+
+				num_comets_alive++;
+
+				comets[i].x = comets[i].x + 0;
+				comets[i].y = comets[i].y + speed;
+	      
+				if (comets[i].y >= (screen->h - images[IMG_CITY_BLUE]->h) && comets[i].expl == 0) {
+
+					/* Disable shields or destroy city: */
+		      
+					if (cities[comets[i].city].shields) {
+						cities[comets[i].city].shields = 0;
+						PlaySound(sounds[SND_SHIELDSDOWN]);
+						laser_add_score(-500 * (diff_level+1));
+					} else {
+						cities[comets[i].city].expl = CITY_EXPL_START;
+						PlaySound(sounds[SND_EXPLOSION]);
+						laser_add_score(-1000 * (diff_level+1));
+					}
+
+					tux_anim = IMG_TUX_FIST1;
+					tux_anim_frame = ANIM_FRAME_START;
+
+					/* Destroy comet: */
+
+					comets[i].expl = COMET_EXPL_START;
+				}
+
+				/* Handle comet explosion animation: */
+
+				if (comets[i].expl != 0) {
+					comets[i].expl--;
+
+					if (comets[i].expl == 0)
+						comets[i].alive = 0;
+				}
+			}
+		}
+
+
+		/* Handle laser: */
+
+		if (laser.alive > 0)
+			laser.alive--;
+     
+		/* Comet time! */
+
+		if (level_start_wait == 0 && (frame % 5) == 0 && gameover == 0) {
+			if (num_attackers > 0) {
+
+				/* More comets to add during this wave! */
+		
+				if ((num_comets_alive < 2 || ((rand() % 4) == 0)) && distanceMoved > 40) {
+					distanceMoved = 0;
+					laser_add_comet(diff_level);
+					num_attackers--;
+				}
+			} else {
+				if (num_comets_alive == 0) {
+
+					/* Time for the next wave! */
+
+					/* FIXME: End of level stuff goes here */
+
+					if (num_cities_alive > 0) {
+
+						/* Go on to the next wave: */
+						wave++;
+						laser_reset_level(diff_level);
+
+					} else {
+
+						/* No more cities!  Game over! */
+						gameover = GAMEOVER_COUNTER_START;
+					}
+				}
+			}
+		}
+
+
+		/* Handle cities: */
+     
+		num_cities_alive = 0;
+
+		for (i = 0; i < NUM_CITIES; i++) 
+			if (cities[i].alive) {
+
+				num_cities_alive++;
+
+				/* Handle animated explosion: */
+
+				if (cities[i].expl) {
+					cities[i].expl--;
+		  
+					if (cities[i].expl == 0)
+						cities[i].alive = 0;
+				}
+			}
+                        
+
+		/* Handle game-over: */
+
+		if (gameover > 0) {
+			gameover--;
+
+			if (gameover == 0)
+				done = 1;
+		}
+                
+                if ((num_cities_alive==0) && (gameover == 0))
+                    gameover = GAMEOVER_COUNTER_START;
+      
+		/* Draw background: */
+     
+		SDL_BlitSurface(bkgd, NULL, screen, NULL);
+
+		/* Draw wave: */
+
+		dest.x = 0;
+		dest.y = 0;
+		dest.w = images[IMG_WAVE]->w;
+		dest.h = images[IMG_WAVE]->h;
+
+		SDL_BlitSurface(images[IMG_WAVE], NULL, screen, &dest);
+
+		sprintf(str, "%d", wave);
+		laser_draw_numbers(str, images[IMG_WAVE]->w + (images[IMG_NUMBERS]->w / 10));
+
+
+		/* Draw score: */
+
+		dest.x = (screen->w - ((images[IMG_NUMBERS]->w / 10) * 7) - images[IMG_SCORE]->w);
+		dest.y = 0;
+		dest.w = images[IMG_SCORE]->w;
+		dest.h = images[IMG_SCORE]->h;
+
+		SDL_BlitSurface(images[IMG_SCORE], NULL, screen, &dest);
+      
+		sprintf(str, "%.6d", score);
+		laser_draw_numbers(str, screen->w - ((images[IMG_NUMBERS]->w / 10) * 6));
+      
+      
+		/* Draw comets: */
+      
+		for (i = 0; i < MAX_COMETS; i++) 
+			if (comets[i].alive) {
+
+				/* Decide which image to display: */
+				if (comets[i].expl == 0)
+					img = IMG_COMET1 + ((frame + i) % 3);
+				else
+					img = (IMG_COMETEX2 - (comets[i].expl / (COMET_EXPL_START / 2)));
+	      
+
+				/* Draw it! */
+
+				dest.x = comets[i].x - (images[img]->w / 2);
+				dest.y = comets[i].y - images[img]->h;
+				dest.w = images[img]->w;
+				dest.h = images[img]->h;
+	      
+				SDL_BlitSurface(images[img], NULL, screen, &dest);
+			}
+
+
+		/* Draw letters: */
+
+		for (i = 0; i < MAX_COMETS; i++)
+			if (comets[i].alive && comets[i].expl == 0)
+				laser_draw_let(comets[i].ch, comets[i].x, comets[i].y);
+      
+		/* Draw cities: */
+      
+		if (frame%2 == 0) NEXT_FRAME(shield);
+		for (i = 0; i < NUM_CITIES; i++) {
+
+			/* Decide which image to display: */
+	 
+			if (cities[i].alive) {
+				if (cities[i].expl == 0)
+					img = IMG_CITY_BLUE;
+				else
+					img = (IMG_CITY_BLUE_EXPL5 - (cities[i].expl / (CITY_EXPL_START / 5)));
+			} else 
+				img = IMG_CITY_BLUE_DEAD;
+	  
+	  
+			/* Change image to appropriate color: */
+	  
+			img += ((wave % MAX_CITY_COLORS) * (IMG_CITY_GREEN - IMG_CITY_BLUE));
+	  
+	  
+			/* Draw it! */
+	  
+			dest.x = cities[i].x - (images[img]->w / 2);
+			dest.y = (screen->h) - (images[img]->h);
+			dest.w = (images[img]->w);
+			dest.h = (images[img]->h);
+	  
+			SDL_BlitSurface(images[img], NULL, screen, &dest);
+
+			/* Draw sheilds: */
+
+			if (cities[i].shields) {
+
+				dest.x = cities[i].x - (shield->frame[shield->cur]->w / 2);
+				dest.h = (screen->h) - (shield->frame[shield->cur]->h);
+				dest.w = src.w;
+				dest.h = src.h;
+				SDL_BlitSurface( shield->frame[shield->cur], NULL, screen, &dest);
+
+			}
+		}
+
+
+		/* Draw laser: */
+
+		if (laser.alive)
+			laser_draw_line(laser.x1, laser.y1, laser.x2, laser.y2, 255 / (LASER_START - laser.alive),
+			                192 / (LASER_START - laser.alive), 64);
+
+		laser_draw_console_image(IMG_CONSOLE);
+
+		if (gameover > 0)
+			tux_img = IMG_TUX_FIST1 + ((frame / 2) % 2);
+
+		laser_draw_console_image(tux_img);
+
+
+		/* Draw "Game Over" */
+
+		if (gameover > 0) {
+
+			dest.x = (screen->w - images[IMG_GAMEOVER]->w) / 2;
+			dest.y = (screen->h - images[IMG_GAMEOVER]->h) / 2;
+			dest.w = images[IMG_GAMEOVER]->w;
+			dest.h = images[IMG_GAMEOVER]->h;
+	
+			SDL_BlitSurface(images[IMG_GAMEOVER], NULL, screen, &dest);
+		}
+      
+      
+		/* Swap buffers: */
+      
+		SDL_Flip(screen);
+
+
+		/* If we're in "PAUSE" mode, pause! */
+
+		if (paused) {
+			quit = Pause();
+			paused = 0;
+		}
+
+      
+		/* Keep playing music: */
+      
+		if (settings.sys_sound && !Mix_PlayingMusic())
+			MusicPlay(musics[MUS_GAME + (rand() % NUM_MUSICS)], 0);
+      
+		/* Pause (keep frame-rate event) */
+      
+		now_time = SDL_GetTicks();
+		if (now_time < last_time + FPS)
+			SDL_Delay(last_time + FPS - now_time);
+	}
+		while (!done && !quit);
+
+  
+	/* Free background: */
+
+	if (bkgd != NULL)
+		SDL_FreeSurface(bkgd);
+
+	/* Stop music: */
+	if ((settings.sys_sound) && (Mix_PlayingMusic()))
+		Mix_HaltMusic();
+ 
+	laser_unload_data();
+ 
+	return 1;
+}
+
+
+/*****************************************************/
+/*                                                   */
+/*          Local ("private") functions:             */
+/*                                                   */
+/*****************************************************/
+
+
+
+
+/* --- Load all media --- */
+static void laser_load_data(void)
+{
+	int i;
+
+	/* Create the SDL_Surfaces for all of the characters */
+        /* used in the word list: */
+	font = LoadFont(settings.theme_font_name, COMET_ZAP_FONT_SIZE);
+	RenderLetters(font);
+
+	/* Load images: */
+	for (i = 0; i < NUM_IMAGES; i++) 
+		images[i] = LoadImage(image_filenames[i], IMG_ALPHA);
+	shield = LoadSprite( "cities/shield", IMG_ALPHA );
+
+	if (settings.sys_sound) {
+		for (i = 0; i < NUM_SOUNDS; i++)
+			sounds[i] = LoadSound(sound_filenames[i]);
+
+		for (i = 0; i < NUM_MUSICS; i++)
+			musics[i] = LoadMusic(music_filenames[i]);
+	}
+
+//	PauseLoadMedia();
+}
+
+
+/* --- unload all media --- */
+static void laser_unload_data(void) {
+	int i;
+
+	FreeLetters();
+
+	for (i = 0; i < NUM_IMAGES; i++)
+		SDL_FreeSurface(images[i]);
+
+	if (settings.sys_sound) {
+		for (i = 0; i < NUM_SOUNDS; i++)
+			Mix_FreeChunk(sounds[i]);
+		for (i = 0; i < NUM_MUSICS; i++)
+			Mix_FreeMusic(musics[i]);
+	}
+
+	FreeSprite(shield);
+        shield = NULL;
+
+//	PauseUnloadMedia();
+
+	TTF_CloseFont(font);
+        font = NULL;
+}
+
+
+/* Reset stuff for the next level! */
+
+static void laser_reset_level(int diff_level)
+{
+  unsigned char fname[1024];
+  static int last_bkgd = -1;
+  int i;
+  
+  /* Clear all comets: */
+  
+  for (i = 0; i < MAX_COMETS; i++)
+    comets[i].alive = 0;
+  
+  /* Load diffrent random background image: */
+  LOG("Loading background in laser_reset_level()\n");
+
+  do {
+    i = rand() % NUM_BKGDS;
+    DOUT(i);
+  }
+  while (i == last_bkgd);
+
+  last_bkgd = i;
+
+  DOUT(i);
+
+  sprintf(fname, "backgrounds/%d.jpg", i);
+
+  LOG("Will try to load file:");
+  LOG(fname);
+
+  if (bkgd != NULL)
+    SDL_FreeSurface(bkgd);
+
+  bkgd = LoadImage(fname, IMG_REGULAR);
+
+  if (bkgd == NULL)
+  {
+    fprintf(stderr,
+     "\nWarning: Could not load background image:\n"
+     "%s\n"
+     "The Simple DirectMedia error that ocurred was: %s\n",
+     fname, SDL_GetError());
+  }
+
+  /* Record score before this wave: */
+
+  pre_wave_score = score;
+
+  /* Set number of attackers & speed for this wave: */
+
+  switch (diff_level) {
+    case 0 : speed = 1 + (wave/5); num_attackers=15; break;
+    case 1 : speed = 1 + (wave/4); num_attackers=15; break;
+    case 2 : speed = 1 + ((wave<<1)/3); num_attackers=(wave<<1); break;
+    case 3 : speed = 1 + wave; num_attackers=(wave<<1); break;
+    default: LOG("diff_level not recognized!\n");
+  }
+
+  distanceMoved = 100; // so that we don't have to wait to start the level
+  LOG("Leaving laser_reset_level()\n");
+}
+
+
+/* Add an comet to the game (if there's room): */
+
+static void laser_add_comet(int diff_level) {
+
+	int target, location = 0;
+	static int last = -1;
+	int targeted[NUM_CITIES] = { 0 };
+	int add = (rand() % (diff_level + 2));
+
+	LOG ("Entering laser_add_comet()\n");
+	DEBUGCODE { fprintf(stderr, "Adding %d comets \n", add); }
+
+	if (0 == NUM_CITIES % 2) /* Even number of cities */
+	{
+          LOG("NUM_CITIES is even\n");
+	  while ((add > 0) && (location != MAX_COMETS))
+	  {
+            /* Look for a free comet slot: */
+            while ((comets[location].alive == 1) && (location < MAX_COMETS))
+            {
+              location++; 
+            }
+            if (location < MAX_COMETS)
+            {
+              comets[location].alive = 1;
+              /* Pick a city to attack: */
+              do
+              { 
+                target = (rand() % NUM_CITIES);
+              } while (target == last || targeted[target] == 1);
+
+              last = target;
+              targeted[target] = 1;
+
+              /* Set comet to target that city: */
+              comets[location].city = target; 
+
+              /* Start at the top, above the city in question: */
+              comets[location].x = cities[target].x;
+              comets[location].y = 0;
+
+              /* Pick a letter */
+              comets[location].ch = GetLetter();
+              /* single letters always shootable: */
+              comets[location].shootable = 1;
+              comets[location].next = NULL;
+
+              add--;
+            }
+            DEBUGCODE {if (location == MAX_COMETS) 
+			printf("Location == MAX_COMETS, we have max on screen\n");}
+	  } 
+	}
+	else /* Odd number of cities (is this a hack that means we are using words?) */
+        {
+          LOG("NUM_CITIES is odd\n");
+          wchar_t* word = GetWord();
+          int i = 0;
+          comet_type* prev_comet = NULL;
+
+          DEBUGCODE {fprintf(stderr, "word is: %S\tlength is: %d\n", word, (int)wcslen(word));}
+          do
+          { 
+  	    target = rand() % (NUM_CITIES - wcslen(word) + 1);
+          } while (target == last);
+          last = target;
+
+		for (i=0; i < wcslen(word); i++)
+		{
+ 			while ((comets[location].alive == 1) && (location < MAX_COMETS))
+				location++; 
+
+  			if (location < MAX_COMETS)
+			{
+				/* First comet in word is shootable: */
+				if (0 == i)
+				  comets[location].shootable = 1;
+				else
+				  comets[location].shootable = 0;
+
+				comets[location].alive = 1;
+				comets[location].city = target + i; 
+				comets[location].x = cities[target + i].x;
+				comets[location].y = 0;
+				comets[location].ch = word[i];
+				comets[location].next = NULL;
+
+				/* Take care of link from previous letter's comet: */
+				if (prev_comet)
+				  prev_comet->next = &comets[location];
+				/* Save pointer for next time through: */
+                                prev_comet = &comets[location];
+
+				DEBUGCODE {fprintf(stderr, "Assigning letter to comet: %C\n", word[i]);}
+			}
+		}
+	}
+	LOG ("Leaving laser_add_comet()\n");
+}
+
+
+/* Draw numbers/symbols over the attacker: */
+
+static void laser_draw_let(wchar_t c, int x, int y)
+{
+  /* Draw letter in correct place relative to comet: */
+  const int offset_x = -10; /* Values determined by trial and error: */
+  const int offset_y = -50;
+
+  SDL_Rect dst;
+  SDL_Surface* s;
+  dst.x = x + offset_x;
+  dst.y = y + offset_y;
+  s = GetWhiteGlyph(c);
+  if (s)
+    SDL_BlitSurface(s, NULL, screen, &dst); 
+}
+
+
+/* Draw status numbers: */
+
+static void laser_draw_numbers(const unsigned char* str, int x)
+{
+  int i, cur_x, c;
+  SDL_Rect src, dest;
+
+
+  cur_x = x;
+
+
+  /* Draw each character: */
+  
+  for (i = 0; i < strlen(str); i++)
+    {
+      c = -1;
+
+
+      /* Determine which character to display: */
+      
+      if (str[i] >= '0' && str[i] <= '9')
+	c = str[i] - '0';
+      
+
+      /* Display this character! */
+      
+      if (c != -1)
+	{
+	  src.x = c * (images[IMG_NUMBERS]->w / 10);
+	  src.y = 0;
+	  src.w = (images[IMG_NUMBERS]->w / 10);
+	  src.h = images[IMG_NUMBERS]->h;
+	  
+	  dest.x = cur_x;
+	  dest.y = 0;
+	  dest.w = src.w;
+	  dest.h = src.h;
+	  
+	  SDL_BlitSurface(images[IMG_NUMBERS], &src,
+			  screen, &dest);
+
+
+          /* Move the 'cursor' one character width: */
+
+	  cur_x = cur_x + (images[IMG_NUMBERS]->w / 10);
+	}
+    }
+}
+
+/* Draw a line: */
+
+static void laser_draw_line(int x1, int y1, int x2, int y2, int red, int grn, int blu)
+{
+  int dx, dy, tmp;
+  float m, b;
+  Uint32 pixel;
+  SDL_Rect dest;
+ 
+  pixel = SDL_MapRGB(screen->format, red, grn, blu);
+
+  dx = x2 - x1;
+  dy = y2 - y1;
+
+  laser_putpixel(screen, x1, y1, pixel);
+  
+  if (dx != 0)
+  {
+    m = ((float) dy) / ((float) dx);
+    b = y1 - m * x1;
+
+    if (x2 > x1)
+      dx = 1;
+    else
+      dx = -1;
+
+    while (x1 != x2)
+    {
+      x1 = x1 + dx;
+      y1 = m * x1 + b;
+      
+      laser_putpixel(screen, x1, y1, pixel);
+    }
+  }
+  else
+  {
+    if (y1 > y2)
+    {
+      tmp = y1;
+      y1 = y2;
+      y2 = tmp;
+    }
+    
+    dest.x = x1;
+    dest.y = y1;
+    dest.w = 3;
+    dest.h = y2 - y1;
+
+    SDL_FillRect(screen, &dest, pixel);
+  }
+}
+
+
+/* Draw a single pixel into the surface: */
+
+static void laser_putpixel(SDL_Surface * surface, int x, int y, Uint32 pixel)
+{
+#ifdef PUTPIXEL_RAW
+  int bpp;
+  Uint8 * p;
+  
+  /* Determine bytes-per-pixel for the surface in question: */
+  
+  bpp = surface->format->BytesPerPixel;
+  
+  
+  /* Set a pointer to the exact location in memory of the pixel
+     in question: */
+  
+  p = (Uint8 *) (surface->pixels +       /* Start at beginning of RAM */
+                 (y * surface->pitch) +  /* Go down Y lines */
+                 (x * bpp));             /* Go in X pixels */
+  
+  
+  /* Assuming the X/Y values are within the bounds of this surface... */
+  
+  if (x >= 0 && y >= 0 && x < surface -> w && y < surface -> h)
+    {
+      /* Set the (correctly-sized) piece of data in the surface's RAM
+         to the pixel value sent in: */
+      
+      if (bpp == 1)
+        *p = pixel;
+      else if (bpp == 2)
+        *(Uint16 *)p = pixel;
+      else if (bpp == 3)
+        {
+          if (SDL_BYTEORDER == SDL_BIG_ENDIAN)
+            {
+              p[0] = (pixel >> 16) & 0xff;
+              p[1] = (pixel >> 8) & 0xff;
+              p[2] = pixel & 0xff;
+            }
+          else
+            {
+              p[0] = pixel & 0xff;
+              p[1] = (pixel >> 8) & 0xff;
+              p[2] = (pixel >> 16) & 0xff;
+            }
+        }
+      else if (bpp == 4)
+        {
+          *(Uint32 *)p = pixel;
+        }
+    }
+#else
+  SDL_Rect dest;
+
+  dest.x = x;
+  dest.y = y;
+  dest.w = 3;
+  dest.h = 4;
+
+  SDL_FillRect(surface, &dest, pixel);
+#endif
+}
+
+
+/* Draw image at lower center of screen: */
+
+static void laser_draw_console_image(int i)
+{
+  SDL_Rect dest;
+
+  dest.x = (screen->w - images[i]->w) / 2;
+  dest.y = (screen->h - images[i]->h);
+  dest.w = images[i]->w;
+  dest.h = images[i]->h;
+
+  SDL_BlitSurface(images[i], NULL, screen, &dest);
+}
+
+
+/* Increment score: */
+
+static void laser_add_score(int inc)
+{
+  score += inc;
+  if (score < 0) score = 0;
+}
+

Added: tuxtype/branches/tuxtype-reorg/src/laser.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/laser.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/laser.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,188 @@
+
+#ifndef LASER_H
+#define LASER_H
+
+#define MAX_COMETS 30
+#define NUM_CITIES 9   /* MUST BE AN EVEN NUMBER! */
+
+#define NUM_BKGDS 5
+#define MAX_CITY_COLORS 4
+
+typedef struct comet_type {
+  int alive;
+  int expl;
+  int city;
+  int x, y;
+  int shootable;
+  struct comet_type* next;
+  wchar_t ch;
+} comet_type;
+
+typedef struct city_type {
+  int alive, expl, shields;
+  int x;
+} city_type;
+
+typedef struct laser_type {
+  int alive;
+  int x1, y1;
+  int x2, y2;
+} laser_type;
+
+enum {
+  IMG_TUX_HELMET1,
+  IMG_TUX_HELMET2,
+  IMG_TUX_HELMET3,
+  IMG_CITY_BLUE,
+  IMG_CITY_BLUE_EXPL1,
+  IMG_CITY_BLUE_EXPL2,
+  IMG_CITY_BLUE_EXPL3,
+  IMG_CITY_BLUE_EXPL4,
+  IMG_CITY_BLUE_EXPL5,
+  IMG_CITY_BLUE_DEAD,
+  IMG_CITY_GREEN,
+  IMG_CITY_GREEN_EXPL1,
+  IMG_CITY_GREEN_EXPL2,
+  IMG_CITY_GREEN_EXPL3,
+  IMG_CITY_GREEN_EXPL4,
+  IMG_CITY_GREEN_EXPL5,
+  IMG_CITY_GREEN_DEAD,
+  IMG_CITY_ORANGE,
+  IMG_CITY_ORANGE_EXPL1,
+  IMG_CITY_ORANGE_EXPL2,
+  IMG_CITY_ORANGE_EXPL3,
+  IMG_CITY_ORANGE_EXPL4,
+  IMG_CITY_ORANGE_EXPL5,
+  IMG_CITY_ORANGE_DEAD,
+  IMG_CITY_RED,
+  IMG_CITY_RED_EXPL1,
+  IMG_CITY_RED_EXPL2,
+  IMG_CITY_RED_EXPL3,
+  IMG_CITY_RED_EXPL4,
+  IMG_CITY_RED_EXPL5,
+  IMG_CITY_RED_DEAD,
+  IMG_COMET1,
+  IMG_COMET2,
+  IMG_COMET3,
+  IMG_COMETEX1,
+  IMG_COMETEX2,
+  IMG_CONSOLE,
+  IMG_TUX_CONSOLE1,
+  IMG_TUX_CONSOLE2,
+  IMG_TUX_CONSOLE3,
+  IMG_TUX_CONSOLE4,
+  IMG_TUX_RELAX1,
+  IMG_TUX_RELAX2,
+  IMG_TUX_DRAT,
+  IMG_TUX_YIPE,
+  IMG_TUX_YAY1,
+  IMG_TUX_YAY2,
+  IMG_TUX_YES1,
+  IMG_TUX_YES2,
+  IMG_TUX_SIT,
+  IMG_TUX_FIST1,
+  IMG_TUX_FIST2,
+  IMG_WAVE,
+  IMG_SCORE,
+  IMG_NUMBERS,
+  IMG_GAMEOVER,
+  NUM_IMAGES
+};
+
+
+static unsigned char * image_filenames[NUM_IMAGES] = {
+  "status/tux_helmet1.png",
+  "status/tux_helmet2.png",
+  "status/tux_helmet3.png", 
+  "cities/city-blue.png",
+  "cities/csplode-blue-1.png",
+  "cities/csplode-blue-2.png",
+  "cities/csplode-blue-3.png",
+  "cities/csplode-blue-4.png",
+  "cities/csplode-blue-5.png",
+  "cities/cdead-blue.png",
+  "cities/city-green.png",
+  "cities/csplode-green-1.png",
+  "cities/csplode-green-2.png",
+  "cities/csplode-green-3.png",
+  "cities/csplode-green-4.png",
+  "cities/csplode-green-5.png",
+  "cities/cdead-green.png",
+  "cities/city-orange.png",
+  "cities/csplode-orange-1.png",
+  "cities/csplode-orange-2.png",
+  "cities/csplode-orange-3.png",
+  "cities/csplode-orange-4.png",
+  "cities/csplode-orange-5.png",
+  "cities/cdead-orange.png",
+  "cities/city-red.png",
+  "cities/csplode-red-1.png",
+  "cities/csplode-red-2.png",
+  "cities/csplode-red-3.png",
+  "cities/csplode-red-4.png",
+  "cities/csplode-red-5.png",
+  "cities/cdead-red.png",
+  "comets/comet1.png",
+  "comets/comet2.png",
+  "comets/comet3.png",
+  "comets/cometex1.png",
+  "comets/cometex2.png",
+  "tux/console.png",
+  "tux/tux-console1.png",
+  "tux/tux-console2.png",
+  "tux/tux-console3.png",
+  "tux/tux-console4.png",
+  "tux/tux-relax1.png",
+  "tux/tux-relax2.png",
+  "tux/tux-drat.png",
+  "tux/tux-yipe.png",
+  "tux/tux-yay1.png",
+  "tux/tux-yay2.png",
+  "tux/tux-yes1.png",
+  "tux/tux-yes2.png",
+  "tux/tux-sit.png",
+  "tux/tux-fist0.png",
+  "tux/tux-fist1.png",
+  "status/wave.png",
+  "status/score.png",
+  "status/numbers.png",
+  "status/gameover.png"
+};
+
+enum {
+  SND_POP,
+  SND_LASER,
+  SND_BUZZ,
+  SND_ALARM,
+  SND_SHIELDSDOWN,
+  SND_EXPLOSION,
+  SND_CLICK,
+  NUM_SOUNDS
+};
+
+
+static unsigned char * sound_filenames[NUM_SOUNDS] = {
+  "pop.wav",
+  "laser.wav",
+  "buzz.wav",
+  "alarm.wav",
+  "shieldsdown.wav",
+  "explosion.wav",
+  "click.wav"
+};
+
+
+enum {
+  MUS_GAME,
+  MUS_GAME2,
+  MUS_GAME3,
+  NUM_MUSICS
+};
+
+static unsigned char * music_filenames[NUM_MUSICS] = {
+  "game.mod",
+  "game2.mod",
+  "game3.mod"
+};
+
+#endif

Added: tuxtype/branches/tuxtype-reorg/src/loaders.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/loaders.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/loaders.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,448 @@
+/***************************************************************************
+ -  file: loaders.c
+ -  description: Functions to load multimedia for Tux Typing
+                             -------------------
+    begin                : Thu May 4 2000
+    copyright            : (C) 2000 by Sam Hart
+                         : (C) 2003 by Jesse Andrews
+    email                : tuxtype-dev at tux4kids.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+/* Local function prototypes: */
+static int max(int n1, int n2);
+static SDL_Surface* flip(SDL_Surface *in, int x, int y);
+
+/* Returns 1 if valid file, 2 if valid dir, 0 if neither: */
+int CheckFile(const char* file)
+{
+  FILE* fp = NULL;
+  DIR* dp = NULL;
+
+  if (!file)
+  {
+    fprintf(stderr, "CheckFile(): invalid char* argument!");
+    return;
+  }
+
+  DEBUGCODE {fprintf(stderr, "CheckFile() - checking: %s\n", file);} 
+
+  dp = opendir(file);
+  if (dp)
+  {
+    LOG("Opened successfully as DIR\n");
+
+    closedir(dp);
+    return 2;
+  }
+
+  fp = fopen(file, "r");
+  if (fp)
+  {
+    LOG("Opened successfully as FILE\n");
+    fclose(fp);
+    return 1;
+  }
+
+  LOG("Unable to open as either FILE or DIR\n");
+  return 0;
+}
+
+
+/* FIXME need to read language's font name, if needed - e.g. Russian. */
+/* also should have return value reflect success or failure.     */
+void LoadLang(void)
+{
+  char fn[FNLEN];
+
+  /* we only need to load a lang.po file if we
+   * are actually using a theme, so this is a little
+   * different than the other loaders 
+   */ 
+
+  if (settings.use_english)
+  {
+    /* We need to set the locale to something supporting UTF-8: */
+    if (!setlocale(LC_CTYPE, "en_US.UTF-8"))
+      fprintf(stderr, "Cannot support UTF-8, ASCII-only words will be used\n");
+    return;
+  }
+
+  /* --- create full path to the lang.po file --- */
+  sprintf( fn, "%s/lang.po", settings.theme_data_path);
+
+  /* FIXME should have program try to setlocale() to lang-specific locale -  */
+  /* for now, at least get a default UTF-8 encoding set: */
+  if (!setlocale(LC_CTYPE, "en_US.UTF-8"))
+    fprintf(stderr, "Cannot support UTF-8, ASCII-only words will be used\n");
+
+  /* This function confusingly returns 0 if successful! */
+  if (0 != Load_PO_File( fn ))  /* Meaning it failed! */
+  {
+    /* failed to find a lang.po file, clear gettext & return */
+    fprintf(stderr, "LoadLang() - could not load lang.po file for %s\n", fn);
+    return;
+  }
+}
+
+int max(int n1, int n2)
+{
+	return (n1 > n2 ? n1 : n2);
+}
+
+/**********************
+ Flip:
+   input: a SDL_Surface, x, y
+   output: a copy of the SDL_Surface flipped via rules:
+
+     if x is a positive value, then flip horizontally
+     if y is a positive value, then flip vertically
+
+     note: you can have it flip both
+**********************/
+SDL_Surface* flip(SDL_Surface* in, int x, int y ) {
+	SDL_Surface *out, *tmp;
+	SDL_Rect from_rect, to_rect;
+	Uint32	flags;
+	Uint32  colorkey=0;
+
+	/* --- grab the settings for the incoming pixmap --- */
+
+	SDL_LockSurface(in);
+	flags = in->flags;
+
+	/* --- change in's flags so ignore colorkey & alpha --- */
+
+	if (flags & SDL_SRCCOLORKEY) {
+		in->flags &= ~SDL_SRCCOLORKEY;
+		colorkey = in->format->colorkey;
+	}
+	if (flags & SDL_SRCALPHA) {
+		in->flags &= ~SDL_SRCALPHA;
+	}
+
+	SDL_UnlockSurface(in);
+
+	/* --- create our new surface --- */
+
+	out = SDL_CreateRGBSurface(
+		SDL_SWSURFACE,
+		in->w, in->h, 32, RMASK, GMASK, BMASK, AMASK);
+
+	/* --- flip horizontally if requested --- */
+
+	if (x) {
+		from_rect.h = to_rect.h = in->h;
+		from_rect.w = to_rect.w = 1;
+		from_rect.y = to_rect.y = 0;
+		from_rect.x = 0;
+		to_rect.x = in->w - 1;
+
+		do {
+			SDL_BlitSurface(in, &from_rect, out, &to_rect);
+			from_rect.x++;
+			to_rect.x--;
+		} while (to_rect.x >= 0);
+	}
+
+	/* --- flip vertically if requested --- */
+
+	if (y) {
+		from_rect.h = to_rect.h = 1;
+		from_rect.w = to_rect.w = in->w;
+		from_rect.x = to_rect.x = 0;
+		from_rect.y = 0;
+		to_rect.y = in->h - 1;
+
+		do {
+			SDL_BlitSurface(in, &from_rect, out, &to_rect);
+			from_rect.y++;
+			to_rect.y--;
+		} while (to_rect.y >= 0);
+	}
+
+	/* --- restore colorkey & alpha on in and setup out the same --- */
+
+	SDL_LockSurface(in);
+
+	if (flags & SDL_SRCCOLORKEY) {
+		in->flags |= SDL_SRCCOLORKEY;
+		in->format->colorkey = colorkey;
+		tmp = SDL_DisplayFormat(out);
+		SDL_FreeSurface(out);
+		out = tmp;
+		out->flags |= SDL_SRCCOLORKEY;
+		out->format->colorkey = colorkey;
+	} else if (flags & SDL_SRCALPHA) {
+		in->flags |= SDL_SRCALPHA;
+		tmp = SDL_DisplayFormatAlpha(out);
+		SDL_FreeSurface(out);
+		out = tmp;
+	} else {
+		tmp = SDL_DisplayFormat(out);
+		SDL_FreeSurface(out);
+		out = tmp;
+	}
+
+	SDL_UnlockSurface(in);
+
+	return out;
+}
+
+
+/* FIXME need code to search for font paths on different platforms */
+TTF_Font* LoadFont(const char* font_name, int font_size )
+{
+  TTF_Font* loaded_font = NULL;
+  char fn[FNLEN];
+  int i;
+
+  /* try to find font in default data dir: */
+  sprintf(fn, "%s/fonts/%s", settings.default_data_path, font_name );
+
+  DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s using data paths\n", fn); }
+
+  /* try to load the font, if successful, return font*/
+  loaded_font = TTF_OpenFont(fn, font_size);
+  if (loaded_font != NULL)
+    return loaded_font;
+		
+
+  /* HACK hard-coded for Debian (and current exact font names): */ 
+
+  if (strncmp(font_name, "AndikaDesRevG.ttf", FNLEN ) == 0)
+    sprintf(fn, "/usr/share/fonts/truetype/ttf-sil-andika/AndikaDesRevG.ttf");
+  else if (strncmp(font_name, "DoulosSILR.ttf", FNLEN ) == 0)
+    sprintf(fn, "/usr/share/fonts/truetype/ttf-sil-doulos/DoulosSILR.ttf");
+  else if (strncmp(font_name, "Rachana_w01.ttf", FNLEN ) == 0)
+    sprintf(fn, "/usr/share/fonts/truetype/ttf-malayalam-fonts/Rachana_w01.ttf");
+
+
+
+  DEBUGCODE { fprintf(stderr, "LoadFont(): looking for %s\n in OS' font path\n", fn); }
+
+  /* try to load the font, if successful, return font*/
+  loaded_font = TTF_OpenFont(fn, font_size);
+  if (loaded_font != NULL)
+    return loaded_font;
+
+  fprintf(stderr, "LoadFont(): Error - couldn't load font: %s\n", fn);
+  return NULL;
+}
+
+/***********************
+	LoadImage : Load an image and set transparent if requested
+************************/
+SDL_Surface* LoadImage(const char* datafile, int mode)
+{
+  int oldDebug;  //so we can turn off debug output for this func only
+  SDL_Surface* tmp_pic = NULL, *final_pic = NULL;
+  char fn[FNLEN];
+
+//  oldDebug = settings.debug_on;  // suppress output for now
+//  settings.debug_on = 0;
+
+  DEBUGCODE { fprintf(stderr, "LoadImage: loading %s\n", datafile ); }
+
+  /* Look for image under theme path if desired: */
+  if (!settings.use_english && !(mode & IMG_NO_THEME))
+  {
+    sprintf(fn, "%s/images/%s", settings.theme_data_path, datafile);
+    DEBUGCODE { fprintf(stderr, "LoadImage: looking in %s\n", fn); }
+
+    tmp_pic = IMG_Load(fn);
+    if (tmp_pic != NULL)
+      DEBUGCODE { fprintf(stderr, "Graphics file %s successfully loaded\n", fn);}
+    else
+      DEBUGCODE { fprintf(stderr, "Warning: graphics file %s could not be loaded\n", fn);}
+  }
+
+  /* If we don't have a valid image yet, try the default path: */
+  if (!tmp_pic)
+  {
+    sprintf(fn, "%s/images/%s", settings.default_data_path, datafile);
+    DEBUGCODE { fprintf(stderr, "LoadImage: looking in %s\n", fn); }
+
+    tmp_pic = IMG_Load(fn);
+    if (tmp_pic != NULL)
+      DEBUGCODE { fprintf(stderr, "Graphics file %s successfully loaded\n", fn);}
+    else
+      DEBUGCODE { fprintf(stderr, "Warning: graphics file %s could not be loaded\n", fn);}
+  }
+
+  /* Couldn't load image - action depends on whether image is essential: */
+  if (!tmp_pic)
+  {
+    if (mode & IMG_NOT_REQUIRED)
+    { 
+//      settings.debug_on = oldDebug;
+      return NULL;
+    }
+
+    fprintf(stderr, "ERROR could not load required graphics file %s\n", datafile);
+    exit(1);
+  }
+
+
+  /* If we get to here, success - setup the image in the proper format: */
+
+  switch (mode & IMG_MODES)
+  {
+    case IMG_REGULAR:
+    { 
+      final_pic = SDL_DisplayFormat(tmp_pic);
+      SDL_FreeSurface(tmp_pic);
+      break;
+    }
+
+    case IMG_ALPHA:
+    {
+      final_pic = SDL_DisplayFormatAlpha(tmp_pic);
+      SDL_FreeSurface(tmp_pic);
+      break;
+    }
+
+    case IMG_COLORKEY:
+    {
+      SDL_LockSurface(tmp_pic);
+      SDL_SetColorKey(tmp_pic,
+                      (SDL_SRCCOLORKEY | SDL_RLEACCEL),
+                      SDL_MapRGB(tmp_pic->format, 255, 255, 0));
+      final_pic = SDL_DisplayFormat(tmp_pic);
+      SDL_FreeSurface(tmp_pic);
+      break;
+    }
+
+    default:
+    {
+      LOG ("Image mode not recognized\n");
+    }
+  }
+
+  LOG( "LoadImage(): Done\n" );
+
+//  settings.debug_on = oldDebug;
+
+  return (final_pic);
+}
+
+sprite* FlipSprite(sprite* in, int X, int Y ) {
+	sprite* out;
+
+	out = malloc(sizeof(sprite));
+	if (in->default_img != NULL)
+		out->default_img = flip( in->default_img, X, Y );
+	else
+		out->default_img = NULL;
+	for ( out->num_frames=0; out->num_frames<in->num_frames; out->num_frames++ )
+		out->frame[out->num_frames] = flip( in->frame[out->num_frames], X, Y );
+	out->cur = 0;
+	return out;
+}
+
+sprite* LoadSprite(const char* name, int MODE ) {
+	sprite *new_sprite;
+	char fn[FNLEN];
+	int x;
+
+	/* JA --- HACK check out what has changed with new code */
+
+	new_sprite = malloc(sizeof(sprite));
+
+	sprintf(fn, "%sd.png", name);
+	new_sprite->default_img = LoadImage( fn, MODE|IMG_NOT_REQUIRED );
+	for (x = 0; x < MAX_SPRITE_FRAMES; x++) {
+		sprintf(fn, "%s%d.png", name, x);
+		new_sprite->frame[x] = LoadImage( fn, MODE|IMG_NOT_REQUIRED );
+		if ( new_sprite->frame[x] == NULL ) {
+			new_sprite->cur = 0;
+			new_sprite->num_frames = x;
+			break;
+		}
+	}
+
+	DEBUGCODE {
+		fprintf( stderr, "loading sprite %s - contains %d frames\n",
+		        name, new_sprite->num_frames );
+	}
+
+	return new_sprite;
+}
+
+void FreeSprite(sprite* gfx )
+{
+  int x;
+
+  if (!gfx)
+    return;
+ 
+  for (x = 0; x < gfx->num_frames; x++)
+    SDL_FreeSurface(gfx->frame[x]);
+  SDL_FreeSurface(gfx->default_img);
+  free(gfx);
+}
+
+/***************************
+	LoadSound : Load a sound/music patch from a file.
+****************************/
+Mix_Chunk* LoadSound(const char* datafile )
+{ 
+  Mix_Chunk* tempChunk = NULL;
+  char fn[FNLEN];
+
+  /* First look under theme path if desired: */
+  if (!settings.use_english)
+  {
+    sprintf(fn , "%s/sounds/%s", settings.theme_data_path, datafile);
+    tempChunk = Mix_LoadWAV(fn);
+    if (tempChunk)
+      return tempChunk;
+  }
+
+  /* If nothing loaded yet, try default path: */
+  if (!tempChunk)
+  {
+    sprintf(fn , "%s/sounds/%s", settings.default_data_path, datafile);
+    tempChunk = Mix_LoadWAV(fn);
+    return tempChunk;
+  }
+}
+
+
+/************************
+	LoadMusic : Load
+	music from a datafile
+*************************/
+Mix_Music* LoadMusic(const char* datafile )
+{ 
+  Mix_Music* temp_music = NULL;
+  char fn[FNLEN];
+
+  /* First look under theme path if desired: */
+  if (!settings.use_english)
+  {
+    sprintf(fn , "%s/sounds/%s", settings.theme_data_path, datafile);
+    temp_music = Mix_LoadMUS(fn);
+    if (temp_music)
+      return temp_music;
+  }
+
+  /* If nothing loaded yet, try default path: */
+  if (!temp_music)
+  {
+    sprintf(fn , "%s/sounds/%s", settings.default_data_path, datafile);
+    temp_music = Mix_LoadMUS(fn);
+    return temp_music;
+  }
+}

Added: tuxtype/branches/tuxtype-reorg/src/main.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/main.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/main.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,161 @@
+/***************************************************************************
+                          main.c 
+ -  description: main tux type file
+                             -------------------
+    begin                : Tue May  2 13:25:06 MST 2000
+    copyright            : (C) 2000 by Sam Hart
+                         : (C) 2003 by Jesse Andrews
+    email                : tuxtype-dev at tux4kids.net
+ ***************************************************************************/
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+SDL_Surface* screen;
+
+
+SDL_Event  event;
+
+
+
+/********************
+  main : init stuff
+*********************/
+int main(int argc, char *argv[])
+{
+  Uint32 video_flags = 0,
+         lib_flags   = 0;
+  int i;
+
+  /* Initialize settings with hard-coded defaults: */ 
+  Opts_Initialize();
+
+	srand(time(NULL));
+
+	// This sets settings.default_data_path to the default theme file path:
+	SetupPaths(NULL);
+
+	LoadSettings();
+	DEBUGCODE { printf("Window setting from config file is: %d\n", settings.fullscreen);}
+
+	if (settings.fullscreen)
+        {
+	  video_flags = (SDL_FULLSCREEN | SDL_SWSURFACE | SDL_HWPALETTE);
+	} 
+        else
+        {
+	  video_flags = (SDL_SWSURFACE | SDL_HWPALETTE);
+	}
+        
+	lib_flags = SDL_INIT_VIDEO;
+	/* FIXME this could go into something like HandleCommandArgs() */
+	// check command line args
+	if (argc > 1) 
+		for (i = 1; i < argc; i++) {
+			if ((strcmp(argv[i], "-h") == 0) |
+			    (strcmp(argv[i], "--help") == 0) | 
+			    (strcmp(argv[i], "-help") == 0)) {
+				fprintf(stderr, "\nUsage:\n tuxtype [OPTION]...");
+				fprintf(stderr, "\n\nOptions:\n\n\t-h, --help, -help");
+				fprintf(stderr, "\n\t\tPrints this help message");
+				fprintf(stderr, "\n\n\t-f, --fullscreen");
+				fprintf(stderr, "\n\t\tSelects fullscreen display (default)");
+				fprintf(stderr, "\n\n\t-w, --window");
+				fprintf(stderr, "\n\t\tSelects windowed display (not fullscreen)");
+				fprintf(stderr, "\n\n\t-s, --sound");
+				fprintf(stderr, "\n\t\tAllow in-game sounds (default)");
+				fprintf(stderr, "\n\n\t-ns, --nosound");
+				fprintf(stderr, "\n\t\tDisables in-game sounds");
+				fprintf(stderr, "\n\n\t-t {THEME}, --theme {THEME}");
+				fprintf(stderr, "\n\t\tUse theme named {THEME}, if it exists");
+				fprintf(stderr, "\n\n\t-sp, --speed");
+				fprintf(stderr, "\n\t\tSpeed up gameplay (for use on slower");
+				fprintf(stderr, "\n\t\tmachines)");
+				fprintf(stderr, "\n\n\t-d, --debug");
+				fprintf(stderr, "\n\t\tEnable debug mode (output)\n");
+				fprintf(stderr, "\n\n\t-v, --version");
+				fprintf(stderr, "\n\t\tDisplay version number and exit\n");
+				exit(0);
+			}
+			if ((strcmp(argv[i], "-v") == 0) |
+			    (strcmp(argv[i], "--version") == 0)) {
+				fprintf(stderr, "\n%s, Version %s\n", PACKAGE, VERSION);
+				fprintf(stderr, "Copyright (C) Sam Hart <hart at geekcomix.com>, under the GPL\n");
+				fprintf(stderr, "-See COPYING file for more info... Thx ;)\n\n");
+				exit(0);
+			}
+			if ((strcmp(argv[i], "-f") == 0) |
+			    (strcmp(argv[i], "--fullscreen") == 0))
+				video_flags = (SDL_FULLSCREEN | SDL_HWPALETTE); // | SDL_HWSURFACE | SDL_DOUBLEBUF);
+			
+			if ((strcmp(argv[i], "-w") == 0) |
+			    (strcmp(argv[i], "--window") == 0)) 
+				video_flags = (SDL_HWPALETTE);  // | SDL_DOUBLEBUF);
+		
+			if ((strcmp(argv[i], "-sp") == 0) |
+			    (strcmp(argv[i], "--speed") == 0)) 
+				settings.speed_up = 1;
+
+			if ((strcmp(argv[i], "-d") == 0) |
+			    (strcmp(argv[i], "--debug") == 0)) 
+				settings.debug_on = 1;
+
+			if ((strcmp(argv[i], "-s") == 0) |
+				(strcmp(argv[i], "--sound") == 0)) 
+				settings.sys_sound = 1;
+			
+			if ((strcmp(argv[i], "-ns") == 0) |
+			    (strcmp(argv[i], "--nosound") == 0)) 
+				settings.sys_sound = 0;
+			
+			if ((strcmp(argv[i], "--hidden") == 0) |
+			    (strcmp(argv[i], "-hidden") == 0)) 
+				settings.hidden = 1;
+			
+			if ((strcmp(argv[i], "-t") == 0) |
+			    (strcmp(argv[i], "--theme") == 0)) 
+				SetupPaths(argv[++i]);
+		}
+
+	DEBUGCODE {
+		fprintf(stderr, "\n%s, version %s BEGIN\n", PACKAGE, VERSION);
+	}
+
+	lib_flags |= SDL_INIT_AUDIO;
+	
+	LibInit(lib_flags); /* calls SDL_Init(), TTF_Init(), some other settings */
+	GraphicsInit(video_flags); /* calls SDL_SetVideoMode(), a few others     */
+
+	if (settings.sys_sound)
+        {
+	    Mix_VolumeMusic(settings.mus_volume);
+	    Mix_Volume(-1, settings.sfx_volume);
+	}
+
+	/* Fix: we should check config files/environment variables like LANG! */
+
+	LoadLang();
+	LoadKeyboard();
+
+	/* Now actually play the game: */
+	TitleScreen();
+
+
+	SaveSettings();
+
+	/* Release heap: */
+	Cleanup();
+
+
+	LOG( "---GAME DONE, EXIT---- Thank you.\n" );
+
+	return EXIT_SUCCESS;
+}

Added: tuxtype/branches/tuxtype-reorg/src/options.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/options.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/options.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,48 @@
+/***************************************************************************
+ -  file: options.c
+ -  description: Functions supporting settings struct for Tux Typing
+                             -------------------
+    begin                : Wed July 11 2007
+    copyright            : (C) 2000 by David Bruce
+                           dbruce at tampabay.rr.com
+
+    project email        : tuxmath-devel at sourceforge.net
+    website              : http://tux4kids.alioth.debian.org
+
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+/* Local function prototypes: */
+
+/* Global (for now) settings struct: */
+game_option_type settings;
+
+/* Simply stick all the default values into the settings struct: */
+void Opts_Initialize(void)
+{
+  strncpy(settings.theme_font_name, DEFAULT_MENU_FONT, FNLEN);
+  settings.use_english = DEFAULT_USE_ENGLISH;
+  settings.fullscreen = DEFAULT_FULLSCREEN;
+  settings.sys_sound = DEFAULT_SYS_SOUND;
+  settings.sfx_volume = DEFAULT_SFX_VOLUME;
+  settings.mus_volume = DEFAULT_MUS_VOLUME;
+  settings.menu_music = DEFAULT_MENU_MUSIC;
+  settings.menu_sound = DEFAULT_MENU_SOUND;
+  settings.speed_up = DEFAULT_SPEED_UP;
+  settings.show_tux4kids = DEFAULT_SHOW_TUX4KIDS;
+  settings.debug_on = DEFAULT_DEBUG_ON;
+  settings.o_lives = DEFAULT_O_LIVES;
+  settings.sound_vol = DEFAULT_SOUND_VOL;
+  settings.hidden = DEFAULT_HIDDEN; 
+}

Added: tuxtype/branches/tuxtype-reorg/src/pause.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/pause.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/pause.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,400 @@
+/***************************************************************************
+pause.c 
+-  description: pause screen for the games
+-------------------
+begin                : Jan 22, 2003
+copyright            : (C) 2003 by Jesse Andrews
+email                : jdandr2 at uky.edu
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+static Mix_Chunk *pause_sfx = NULL;
+static SDL_Surface *up = NULL, *down = NULL, *left = NULL, *right = NULL;
+static SDL_Rect rectUp, rectDown, rectLeft, rectRight;
+static TTF_Font *f1 = NULL, *f2 = NULL;
+
+/* Local function prototypes: */
+static void darkenscreen(void);
+static void draw_vols(int sfx, int mus);
+static void pause_draw(void);
+static void pause_load_media(void);
+static void pause_unload_media(void);
+
+// QUESTION: For usability sake, should escape return to the game
+//           and the user have to choose to quit the game, or ???
+/**********************
+Pause : Pause the game
+***********************/
+int Pause(void)
+{
+	int paused = 1;
+	int sfx_volume=0;
+	int old_sfx_volume;
+	int mus_volume=0;
+	int old_mus_volume;
+	int mousePressed = 0;
+	int quit=0;
+	int tocks=0;  // used for keeping track of when a tock has happened
+	SDL_Event event;
+
+	LOG( "Entering Pause()\n" );
+
+	pause_load_media();
+	/* --- stop all sounds, play pause noise --- */
+
+	if (settings.sys_sound) {
+ 		Mix_Pause(-1);
+		Mix_PlayChannel(-1, pause_sfx, 0);
+		sfx_volume = Mix_Volume(-1, -1);  // get sfx volume w/o changing it
+		mus_volume = Mix_VolumeMusic(-1); // get mus volume w/o changing it
+	}
+
+	/* --- show the pause screen --- */
+
+	SDL_ShowCursor(1);
+
+	// Darken the screen...
+	darkenscreen(); 
+
+	pause_draw();
+
+	if (settings.sys_sound) {
+		draw_vols(sfx_volume, mus_volume);
+	}
+
+	SDL_Flip(screen);
+
+	SDL_EnableKeyRepeat( 1, 20 );
+
+	/* --- wait for space, click, or exit --- */
+
+	while (paused) {
+		old_sfx_volume = sfx_volume;
+		old_mus_volume = mus_volume;
+		while (SDL_PollEvent(&event)) 
+			switch (event.type) {
+				case SDL_QUIT: 
+					exit(0);
+					break;
+				case SDL_KEYUP:
+					if (settings.sys_sound && 
+					   ((event.key.keysym.sym == SDLK_RIGHT) ||
+					    (event.key.keysym.sym == SDLK_LEFT))) 
+					    	tocks = 0;
+					break;
+				case SDL_KEYDOWN:
+					if (event.key.keysym.sym == SDLK_SPACE) 
+						paused = 0;
+					if (event.key.keysym.sym == SDLK_ESCAPE) {
+						paused = 0;
+						quit = 1;
+					}
+					if (settings.sys_sound) { 
+						if (event.key.keysym.sym == SDLK_RIGHT) 
+							sfx_volume += 4;
+						if (event.key.keysym.sym == SDLK_LEFT) 
+							sfx_volume -= 4;
+						if (event.key.keysym.sym == SDLK_UP) 
+							mus_volume += 4;
+						if (event.key.keysym.sym == SDLK_DOWN) 
+							mus_volume -= 4;
+					}
+					break;
+				case SDL_MOUSEBUTTONDOWN:
+					mousePressed = 1;
+					tocks = 0;
+					break;
+				case SDL_MOUSEBUTTONUP:
+					mousePressed = 0;
+					break;
+
+					break;
+			}
+		if (settings.sys_sound && mousePressed) {
+			int x, y;
+
+			SDL_GetMouseState(&x, &y);
+			/* check to see if they clicked on a button */
+
+			if (inRect(rectUp, x, y)) {
+				mus_volume += 4;
+			} else if (inRect(rectDown, x, y)) {
+				mus_volume -= 4;
+			} else if (inRect(rectRight, x, y)) {
+				sfx_volume += 4;
+			} else if (inRect(rectLeft, x, y)) {
+				sfx_volume -= 4;
+			} else {
+
+				/* check to see if they clicked a bar */
+
+				if ((x > rectLeft.x + rectLeft.w) && (x < rectRight.x)) {
+					if ((y >= rectLeft.y) && (y <= rectLeft.y + rectLeft.h)) {
+						sfx_volume = 4+(int)(128.0 * ((x - rectLeft.x - rectLeft.w - 1.0) / (rectRight.x - rectLeft.x - rectLeft.w - 2.0)));
+					}
+					if ((y >= rectDown.y) && (y <= rectDown.y + rectDown.h)) {
+						mus_volume = 4+(int)(128.0 * ((x - rectLeft.x - rectLeft.w - 1.0) / (rectRight.x - rectLeft.x - rectLeft.w - 2.0)));
+					}
+
+				}
+			}
+		}
+
+		if (settings.sys_sound) {
+
+			if (sfx_volume > MIX_MAX_VOLUME)
+				sfx_volume = MIX_MAX_VOLUME;
+			if (sfx_volume < 0)
+				sfx_volume = 0;
+			if (mus_volume > MIX_MAX_VOLUME)
+				mus_volume = MIX_MAX_VOLUME;
+			if (mus_volume < 0)
+				mus_volume = 0;
+
+			if ((mus_volume != old_mus_volume) || 
+			    (sfx_volume != old_sfx_volume)) {
+
+				if (mus_volume != old_mus_volume)
+					Mix_VolumeMusic(mus_volume);
+
+				if (sfx_volume != old_sfx_volume) {
+					Mix_Volume(-1,sfx_volume);
+					if (tocks%4==0)
+						Mix_PlayChannel(-1, pause_sfx, 0);
+					tocks++;
+			    }
+
+				draw_vols(sfx_volume, mus_volume);
+				settings.mus_volume=mus_volume;
+				settings.sfx_volume=sfx_volume;
+				SDL_Flip(screen);
+			}
+		}
+
+		SDL_Delay(33);
+	}
+
+	/* --- Return to previous state --- */
+
+	SDL_EnableKeyRepeat( 0, SDL_DEFAULT_REPEAT_INTERVAL );
+
+	SDL_ShowCursor(0);
+
+	if (settings.sys_sound) {
+		Mix_PlayChannel(-1, pause_sfx, 0);
+		Mix_Resume(-1);
+	}
+
+	pause_unload_media();
+
+	LOG( "Leaving Pause()\n" );
+
+	return (quit);
+}
+
+
+static void pause_load_media(void) {
+	if (settings.sys_sound) 
+		pause_sfx = LoadSound( "tock.wav" );
+
+	up = LoadImage("up.png", IMG_ALPHA);
+	rectUp.w = up->w; rectUp.h = up->h;
+
+	down = LoadImage("down.png", IMG_ALPHA);
+	rectDown.w = down->w; rectDown.h = down->h;
+
+	left = LoadImage("left.png", IMG_ALPHA);
+	rectLeft.w = left->w; rectLeft.h = left->h;
+
+	right = LoadImage("right.png", IMG_ALPHA);
+	rectRight.w = right->w; rectRight.h = right->h;
+
+	f1 = LoadFont(settings.theme_font_name, 24);
+	f2 = LoadFont(settings.theme_font_name, 36);
+}
+
+static void pause_unload_media(void) {
+	if (settings.sys_sound)
+        {
+	  Mix_FreeChunk(pause_sfx);
+	  pause_sfx = NULL;
+        }
+	SDL_FreeSurface(up);
+	SDL_FreeSurface(down);
+	SDL_FreeSurface(left);
+	SDL_FreeSurface(right);
+        up = down = left = right = NULL;
+	TTF_CloseFont(f1);
+	TTF_CloseFont(f2);
+	f1 = f2 = NULL;
+}
+
+
+/* Slightly useful function but not sure this file is the right place for it.  */
+int inRect(SDL_Rect r, int x, int y)
+{
+  if ((x < r.x) || (y < r.y) || (x > r.x + r.w) || (y > r.y + r.h))
+   return 0;
+  return 1;
+}
+
+
+/******************************************/
+/*                                        */
+/*       Local ("private") functions      */
+/*                                        */
+/******************************************/
+
+
+
+static void pause_draw(void)
+{
+  SDL_Rect s;
+  SDL_Surface* t = NULL;
+
+  LOG("Entering pause_draw()\n");
+
+  rectLeft.y = rectRight.y = 200;
+  rectDown.y = rectUp.y = 300;
+
+  rectLeft.x = rectDown.x = 320 - (7*16) - rectLeft.w - 4;
+  rectRight.x = rectUp.x  = 320 + (7*16) + 4;
+
+  /* Avoid segfault if any needed SDL_Surfaces missing: */
+  if (settings.sys_sound
+    && left && right && down && up)
+  {
+    SDL_BlitSurface(left, NULL, screen, &rectLeft);
+    SDL_BlitSurface(right, NULL, screen, &rectRight);
+    SDL_BlitSurface(down, NULL, screen, &rectDown);
+    SDL_BlitSurface(up, NULL, screen, &rectUp);
+  }
+
+  if (settings.sys_sound)
+  {
+    t = BlackOutline(_("Sound Effects Volume"), f1, &white);
+    if (t)
+    {	
+      s.y = 160;
+      s.x = 320 - t->w/2;
+      SDL_BlitSurface(t, NULL, screen, &s);
+      SDL_FreeSurface(t);
+    }
+
+    t = BlackOutline(_("Music Volume"), f1, &white);
+    if (t)
+    {
+      s.y = 260;
+      s.x = 320 - t->w/2;
+      SDL_BlitSurface(t, NULL, screen, &s);
+      SDL_FreeSurface(t);
+    }
+  }
+  else  /* No sound: */
+  {
+    t = BlackOutline(_("Sound & Music Disabled"), f1, &white);
+    if (t)
+    {
+      s.y = 160;
+      s.x = 320 - t->w/2;
+      SDL_BlitSurface(t, NULL, screen, &s);
+      SDL_FreeSurface(t);
+    }
+  }
+
+  t = BlackOutline(_("Paused!"), f2, &white);
+  if (t)
+  {
+	s.y = 60;
+	s.x = 320 - t->w/2;
+	SDL_BlitSurface(t, NULL, screen, &s);
+	SDL_FreeSurface(t);
+  }
+
+  t = BlackOutline(_("Press escape again to return to menu"), f1, &white);
+  if (t)
+  {
+    s.y = 400;
+    s.x = 320 - t->w/2;
+    SDL_BlitSurface(t, NULL, screen, &s);
+    SDL_FreeSurface(t);
+  }
+
+  t = BlackOutline(_("Press space bar to return to game"), f1, &white);
+  if (t)
+  {
+    s.y = 440;
+    s.x = 320 - t->w/2;
+    SDL_BlitSurface(t, NULL, screen, &s);
+    SDL_FreeSurface(t);
+  }
+
+  LOG("Leaving pause_draw()\n");
+}
+
+
+/* FIXME what if rectLeft and rectDown not initialized? - should be args */
+static void draw_vols(int sfx, int mus)
+{
+  SDL_Rect s,m;
+  int i;
+
+  s.y = rectLeft.y; 
+  m.y = rectDown.y;
+  m.w = s.w = 5;
+  s.x = rectLeft.x + rectLeft.w + 5;
+  m.x = rectDown.x + rectDown.w + 5;
+  m.h = s.h = 40;
+
+  for (i = 1; i<=32; i++)
+  {
+    if (sfx >= i * 4)
+      SDL_FillRect(screen, &s, SDL_MapRGB(screen->format, 0, 0, 127 + sfx));
+    else
+      SDL_FillRect(screen, &s, SDL_MapRGB(screen->format, 0, 0, 0));
+
+    if (mus >= i * 4)
+      SDL_FillRect(screen, &m, SDL_MapRGB(screen->format, 0, 0, 127 + mus));
+    else
+      SDL_FillRect(screen, &m, SDL_MapRGB(screen->format, 0, 0, 0));
+
+    m.x = s.x += 7;
+  }
+}
+
+/* ==== fillscreen ====
+ * RESULT: it will darken the screen by a factor of 4
+ * WARNING: only works on 16bit screens right now!
+ */
+static void darkenscreen(void)
+{
+  Uint16 rm = screen->format->Rmask;
+  Uint16 gm = screen->format->Gmask;
+  Uint16 bm = screen->format->Bmask;
+  Uint16* p; 
+  int x, y;
+
+  p = screen->pixels;
+
+  for (y = 0; y < 480; y++) 
+  {
+    for (x = 0; x < 640; x++)
+    {
+      *p = (((*p&rm)>>2)&rm) | (((*p&gm)>>2)&gm) | (((*p&bm)>>2)&bm);
+      p++;
+    }
+  }
+}
+
+

Added: tuxtype/branches/tuxtype-reorg/src/playgame.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/playgame.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/playgame.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,1725 @@
+/***************************************************************************
+playgame.c 
+-  description: Cascade game
+-------------------
+begin                : Fri May 5 2000
+copyright            : (C) 2000 by Sam Hart
+                     : (C) 2003 by Jesse Andrews
+email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+#include "playgame.h"
+#include "snow.h"
+
+//void add_words( int level );
+
+/* Should these be constants? */
+static int tux_max_width;                // the max width of the images of tux
+static int number_max_w;                 // the max width of a number image
+
+//int o_lives; // something cal is working on
+//int sound_vol;
+static TTF_Font* font = NULL;
+static SDL_Surface* background = NULL;
+static SDL_Surface* level[NUM_LEVELS] = {NULL};
+static SDL_Surface* number[NUM_NUMS] = {NULL};
+static SDL_Surface* curlev = NULL;
+static SDL_Surface* lives = NULL;
+static SDL_Surface* fish = NULL;
+static SDL_Surface* congrats[CONGRATS_FRAMES] = {NULL};
+static SDL_Surface* ohno[OH_NO_FRAMES] = {NULL};
+static Mix_Chunk* sound[NUM_WAVES];
+
+static sprite* fishy = NULL;
+static sprite* splat = NULL;
+
+/* --- Data Structure for Dirty Blitting --- */
+static SDL_Rect srcupdate[MAX_UPDATES];
+static SDL_Rect dstupdate[MAX_UPDATES];
+static int numupdates = 0; // tracks how many blits to be done
+
+struct blit {
+    SDL_Surface* src;
+    SDL_Rect* srcrect;
+    SDL_Rect* dstrect;
+    unsigned char type;
+} blits[MAX_UPDATES];
+
+
+
+/* Local function prototypes: */
+static int AddRect(SDL_Rect* src, SDL_Rect* dst);
+static void AddSplat(int* splats, struct fishypoo* f, int* curlives, int* frame);
+static void CheckCollision(int fishies, int* fish_left, int frame );
+static void CheckFishies(int* fishies, int* splats);
+static int check_word(int f);
+static void display_msg(const unsigned char* msg, int x, int y);
+static void DrawBackground(void);
+static void draw_bar(int curlevel, int diflevel, int curlives,
+              int oldlives, int fish_left, int oldfish_left);
+static void DrawFish(int which);
+static void DrawNumbers(int num, int x, int y, int places);
+static int DrawObject(SDL_Surface* surf, int x, int y);
+static int DrawSprite(sprite* gfx, int x, int y);
+static void EraseNumbers(int num, int x, int y, int places);
+static int EraseObject(SDL_Surface* sprite, int x, int y);
+static int EraseSprite(sprite* img, int x, int y);
+static float float_restrict(float a, float x, float b);
+static void FreeGame(void);
+static int int_restrict(int a, int x, int b);
+static void LoadFishies(void);
+static void LoadOthers(void);
+static void LoadTuxAnims(void);
+static void MoveFishies(int* fishies, int* splats, int* lifes, int* frame);
+static void MoveTux(int frame, int fishies);
+static void next_tux_frame(void);
+static void ResetObjects(void);
+static void SpawnFishies(int diflevel, int* fishies, int* frame);
+static void UpdateScreen(int* frame);
+static void UpdateTux(wchar_t letter_pressed, int fishies, int frame);
+static void WaitFrame(void);
+
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Public" functions (callable throughout program)             */
+/*                                                                      */
+/************************************************************************/
+
+/*************************************************************************
+* PlayCascade : This is the main Cascade game loop               *
+*************************************************************************/
+int PlayCascade( int diflevel ) {
+	unsigned char filename[FNLEN];
+	int still_playing = 1;
+	int playing_level = 1;
+	int setup_new_level = 1;
+	int won_level = 0;
+	int quitting = 0;
+	int curlevel = 0;
+	int i;
+	int curlives;
+	int oldlives=0, oldfish_left=0;
+	int fish_left, fishies = 0, local_max_fishies=1;
+	int frame = 0;
+	int done_frames;
+	int splats = 0;
+	SDL_Event event;
+	SDL_Surface *temp_text[CONGRATS_FRAMES + OH_NO_FRAMES];
+	SDL_Rect text_rect;
+	int text_y_end;
+	int xamp, yamp, x_not, y_not;
+	int temp_text_frames;
+	int temp_text_count;
+	Uint16 key_unicode;
+
+	DEBUGCODE {
+		fprintf(stderr, "->PlayCascade: level=%i\n", diflevel );
+	}
+
+	SDL_WarpMouse(screen->w / 2, screen->h / 2);
+	SDL_ShowCursor(0);
+
+	SNOW_init();
+
+	LoadTuxAnims(); 
+	LoadFishies();
+	LoadOthers();
+	RenderLetters(font);
+	LOG( " Done rendering letters \n ");
+
+	/* Make sure everything in the word list is "typable" according to the current */
+        /* theme's keyboard.lst:                                                       */
+	if (!CheckNeededGlyphs())
+	{
+          fprintf(stderr, "PlayCascade() - did not find all needed characters in theme's "
+                          "keyboard.lst file - returning to menu!\n\n\n");
+          FreeGame();
+          return 0;
+	}
+
+
+
+	LOG( " starting game \n ");
+	while (still_playing) {
+
+		if (setup_new_level) {
+
+			switch (diflevel) {
+				case EASY:
+				            fish_left = MAX_FISHIES_EASY;
+				            if (settings.o_lives >  LIVES_INIT_EASY){
+    				    		curlives = settings.o_lives;
+					    }else
+				    		curlives = LIVES_INIT_EASY;
+				            break;
+				case MEDIUM:
+				            fish_left = MAX_FISHIES_MEDIUM;
+				            if (settings.o_lives >  LIVES_INIT_MEDIUM){
+    				    		curlives = settings.o_lives;
+					    }else
+				            curlives =  LIVES_INIT_MEDIUM;
+				            break;
+				case HARD:
+				            fish_left = MAX_FISHIES_HARD;
+				            if (settings.o_lives >  LIVES_INIT_HARD){
+    				    		curlives = settings.o_lives;
+					    }else
+				            curlives =  LIVES_INIT_HARD;
+				            break;
+			}
+
+			local_max_fishies = fish_left;
+
+			if (curlevel != 0) {
+				SDL_FreeSurface(background);
+			}
+
+			if (diflevel == INF_PRACT)
+				sprintf(filename, "pract.png");
+			else
+				sprintf(filename, "kcas%i_%i.jpg", diflevel+1, curlevel+1);
+
+			/* ---  Special Hidden Code  --- */
+
+			if (settings.hidden && curlevel == 3)
+				sprintf(filename, "hidden.jpg");
+
+			DEBUGCODE {
+				fprintf(stderr, "->>Loading background: %s\n", filename);
+			}
+
+			background = LoadImage( filename, IMG_REGULAR );
+			SNOW_setBkg( background );
+
+			DrawBackground();
+
+			ResetObjects();
+
+			if (settings.sys_sound) {
+				sprintf(filename, "kmus%i.wav", curlevel + 1);
+				MusicLoad( filename, -1 );
+			}
+
+			LOG( "->>PLAYING THE GAME\n" );
+
+			setup_new_level = 0;
+		}
+
+		/* --- Poll input queue, get keyboard info --- */
+
+		while (playing_level) {
+
+			oldlives = curlives;
+			oldfish_left = fish_left;
+
+			EraseSprite( tux_object.spr[tux_object.state][tux_object.facing], tux_object.x, tux_object.y );
+
+			/* --- Checking input --- */
+
+			while ( SDL_PollEvent( &event ) ) 
+				if ( event.type == SDL_QUIT ) {
+					exit(0);
+				} else if (event.type == SDL_KEYDOWN) {
+	
+					if (event.key.keysym.sym == SDLK_F11) 
+						SDL_SaveBMP( screen, "screenshot.bmp" );
+					if (event.key.keysym.sym == SDLK_F6){
+						settings.o_lives=settings.o_lives-10;
+						curlives=curlives-10;
+					}
+					if (event.key.keysym.sym == SDLK_F7) {
+						settings.o_lives=settings.o_lives+10;
+						curlives=curlives+10;
+					}
+					if (event.key.keysym.sym == SDLK_F10) 
+						SwitchScreenMode();
+					if (event.key.keysym.sym == SDLK_F12) 
+						SNOW_toggle();
+					if (event.key.keysym.sym == SDLK_ESCAPE) {
+						/* Pause() returns 1 if quitting, */
+						/* 0 if returning to game:        */
+						if (Pause() == 1) {
+							playing_level = 0;
+							still_playing = 0;
+							quitting = 1;
+						} 
+						DrawBackground();
+					}
+
+					key_unicode = event.key.keysym.unicode;
+					//key_unicode = event.key.keysym.unicode & 0xff;
+					/* For now, tuxtype is case-insensitive for input, */
+                                        /* with only uppercase for answers:                */
+					DEBUGCODE
+					{
+					  fprintf(stderr,
+					    "\nkey_unicode = %d\twchar_t = %lc\t\n",
+					     key_unicode, key_unicode);
+					}
+
+                                        if (key_unicode >= 97 && key_unicode <= 122)
+                                          key_unicode -= 32;  //convert lowercase to uppercase
+                                        if (key_unicode >= 224 && key_unicode <= 255)
+                                          key_unicode -= 32; //same for non-US chars
+
+					LOG ("After checking for lower case:\n");
+					DEBUGCODE
+					{
+					  fprintf(stderr,
+					    "key_unicode = %d\twchar_t = %lc\\n\n",
+					     key_unicode, key_unicode);
+					}
+
+					/* Now update with case-folded value: */
+					UpdateTux(key_unicode, fishies, frame);
+				}
+
+			/* --- fishy updates --- */
+
+			if ((frame % 10) == 0) NEXT_FRAME( fishy );
+			
+			if (fishies < local_max_fishies)
+				SpawnFishies( diflevel, &fishies, &frame );
+
+			MoveTux( frame, fishies );
+			CheckCollision(fishies, &fish_left, frame );
+			DrawSprite( tux_object.spr[tux_object.state][tux_object.facing], tux_object.x, tux_object.y );
+			MoveFishies(&fishies, &splats, &curlives, &frame);
+			CheckFishies(&fishies, &splats);
+			SNOW_update();
+
+			/* --- update top score/info bar --- */
+
+			if (diflevel != INF_PRACT) {
+				draw_bar(curlevel, diflevel, curlives, oldlives, fish_left, oldfish_left);
+
+				if (curlives <= 0) {
+					playing_level = 0;
+					still_playing = 0;
+				}
+			} else
+				fish_left = 1; // in practice there is always 1 fish left!
+
+			if (fish_left <= 0) {
+				won_level = 1;
+				playing_level = 0;
+				curlevel++;
+				setup_new_level = 1;
+				still_playing = 1;
+			}
+
+			if (!quitting) {
+				UpdateScreen(&frame);
+
+				if (!settings.speed_up)
+					WaitFrame();
+			}
+		}
+
+		if (settings.sys_sound)
+			Mix_FadeOutMusic(MUSIC_FADE_OUT_MS);
+
+		DrawBackground();
+
+		if (quitting == 0) {
+
+			if (won_level) {
+
+				won_level = 0;
+				if (curlevel < 4) {
+
+					LOG( "--->NEXT LEVEL!\n" );
+
+					done_frames = MAX_END_FRAMES_BETWEEN_LEVELS;
+					playing_level = 1;
+					xamp = 0;
+					yamp = 0;
+
+				} else {
+
+					LOG( "--->WINNER!\n" );
+
+					done_frames = MAX_END_FRAMES_WIN_GAME;
+					still_playing = 0;
+					xamp = WIN_GAME_XAMP;
+					yamp = WIN_GAME_YAMP;
+
+					if (settings.sys_sound) 
+						Mix_PlayChannel(WINFINAL_WAV, sound[WINFINAL_WAV], 0);
+				}
+
+				if (settings.sys_sound) 
+					Mix_PlayChannel(WIN_WAV, sound[WIN_WAV], 0);
+
+				for (i = 0; i < CONGRATS_FRAMES; i++)
+					temp_text[i] = congrats[i];
+
+				temp_text_frames = CONGRATS_FRAMES;
+				tux_object.state = TUX_WINNING;
+
+			} else {
+
+				LOG( "--->LOST :(\n" );
+
+				done_frames = MAX_END_FRAMES_GAMEOVER;
+				xamp = 0;
+				yamp = 0;
+
+				if (settings.sys_sound)
+					Mix_PlayChannel(LOSE_WAV, sound[LOSE_WAV], 0);
+
+				for (i = 0; i < OH_NO_FRAMES; i++)
+					temp_text[i] = ohno[i];
+
+				temp_text_frames = OH_NO_FRAMES;
+				tux_object.state = TUX_YIPING;
+			}
+
+			/* --- draw the animation here --- */
+
+			temp_text_count = 0;
+			text_y_end = (screen->h / 2) - (temp_text[0]->h / 2);
+			text_rect.x = (screen->w / 2) - (temp_text[0]->w / 2);
+			text_rect.y = screen->h - temp_text[0]->h - 1;
+			x_not = text_rect.x;
+
+			LOG( "--->Starting Ending Animation\n" );
+			
+			for ( i=0; i<= done_frames; i++ ) {
+				temp_text_count = (temp_text_count+1) % temp_text_frames;
+
+				text_rect.y -= END_FRAME_DY;
+				y_not = text_rect.y;
+
+				if (text_rect.y < text_y_end) {
+					y_not = text_y_end + yamp * sin(i / WIN_GAME_ANGLE_MULT);
+					text_rect.y = text_y_end;
+					text_rect.x = x_not + xamp * cos(i / WIN_GAME_ANGLE_MULT);
+				}
+
+				DrawSprite( tux_object.spr[tux_object.state][tux_object.facing], tux_object.x, tux_object.y );
+				DrawObject(temp_text[temp_text_count], text_rect.x, y_not);
+				DrawObject(level[diflevel], 1, 1);
+				draw_bar(curlevel - 1, diflevel, curlives, oldlives, fish_left, oldfish_left);
+
+				next_tux_frame();
+				SNOW_update();
+				UpdateScreen(&frame);
+
+				EraseSprite( tux_object.spr[tux_object.state][tux_object.facing], tux_object.x, tux_object.y );
+				
+				EraseObject(temp_text[temp_text_count], text_rect.x, y_not);
+
+				if (!settings.speed_up)
+					WaitFrame();
+			}
+		}
+	}
+
+	SNOW_on = 0;
+
+	LOG( "->Done with level... cleaning up\n" );
+
+	FreeGame();
+
+	LOG( "->PlayCascade: END\n" );
+
+	return 1;
+}
+
+
+
+
+/***********************
+ InitEngine
+ ***********************/
+void InitEngine(void) {
+    int i;
+
+    /* --- Set up the update rectangle pointers --- */
+	
+    for (i = 0; i < MAX_UPDATES; ++i) {
+        blits[i].srcrect = &srcupdate[i];
+        blits[i].dstrect = &dstupdate[i];
+    }
+}
+
+
+
+/*************************************************/
+/* TransWipe: Performs various wipes to new bkgs */
+/*************************************************/
+/*
+ * Given a wipe request type, and any variables
+ * that wipe requires, will perform a wipe from
+ * the current screen image to a new one.
+ */
+int TransWipe(SDL_Surface* newbkg, int type, int var1, int var2)
+{
+    int i, j, x1, x2, y1, y2;
+    int step1, step2, step3, step4;
+    int frame;
+    SDL_Rect src;
+    SDL_Rect dst;
+
+    LOG("->TransWipe(): START\n");
+
+    if (!newbkg)
+    {
+      fprintf(stderr, "TransWipe() - 'newbkg' arg invalid!\n");
+      return 0;
+    }
+
+    numupdates = 0;
+    frame = 0;
+
+    if(newbkg->w == screen->w && newbkg->h == screen->h) {
+        if( type == RANDOM_WIPE )
+            type = (RANDOM_WIPE * ((float) rand()) / (RAND_MAX+1.0));
+
+        switch( type ) {
+            case WIPE_BLINDS_VERT: {
+                LOG("--+ Doing 'WIPE_BLINDS_VERT'\n");
+                /* var1 is num of divisions
+                   var2 is how many frames animation should take */
+                if( var1 < 1 ) var1 = 1;
+                if( var2 < 1 ) var2 = 1;
+                step1 = screen->w / var1;
+                step2 = step1 / var2;
+
+                for(i = 0; i <= var2; i++) {
+                    for(j = 0; j <= var1; j++) {
+                        x1 = step1 * (j - 0.5) - i * step2 + 1;
+                        x2 = step1 * (j - 0.5) + i * step2 + 1;
+                        src.x = x1;
+                        src.y = 0;
+                        src.w = step2;
+                        src.h = screen->h;
+                        dst.x = x2;
+                        dst.y = 0;
+                        dst.w = step2;
+                        dst.h = screen->h;
+                        SDL_BlitSurface(newbkg, &src, screen, &src);
+                        SDL_BlitSurface(newbkg, &dst, screen, &dst);
+                        AddRect(&src, &src);
+                        AddRect(&dst, &dst);
+                    }
+                    UpdateScreen(&frame);
+                }
+
+                src.x = 0;
+                src.y = 0;
+                src.w = screen->w;
+                src.h = screen->h;
+                SDL_BlitSurface(newbkg, NULL, screen, &src);
+                SDL_Flip(screen);
+
+                break;
+            } case WIPE_BLINDS_HORIZ: {
+                LOG("--+ Doing 'WIPE_BLINDS_HORIZ'\n");
+                /* var1 is num of divisions
+                   var2 is how many frames animation should take */
+                if( var1 < 1 ) var1 = 1;
+                if( var2 < 1 ) var2 = 1;
+                step1 = screen->h / var1;
+                step2 = step1 / var2;
+
+                for(i = 0; i <= var2; i++) {
+                    for(j = 0; j <= var1; j++) {
+                        y1 = step1 * (j - 0.5) - i * step2 + 1;
+                        y2 = step1 * (j - 0.5) + i * step2 + 1;
+                        src.x = 0;
+                        src.y = y1;
+                        src.w = screen->w;
+                        src.h = step2;
+                        dst.x = 0;
+                        dst.y = y2;
+                        dst.w = screen->w;
+                        dst.h = step2;
+                        SDL_BlitSurface(newbkg, &src, screen, &src);
+                        SDL_BlitSurface(newbkg, &dst, screen, &dst);
+                        AddRect(&src, &src);
+                        AddRect(&dst, &dst);
+                    }
+                    UpdateScreen(&frame);
+                }
+
+                src.x = 0;
+                src.y = 0;
+                src.w = screen->w;
+                src.h = screen->h;
+                SDL_BlitSurface(newbkg, NULL, screen, &src);
+                SDL_Flip(screen);
+
+                break;
+            } case WIPE_BLINDS_BOX: {
+                LOG("--+ Doing 'WIPE_BLINDS_BOX'\n");
+                /* var1 is num of divisions
+                   var2 is how many frames animation should take */
+                if( var1 < 1 ) var1 = 1;
+                if( var2 < 1 ) var2 = 1;
+                step1 = screen->w / var1;
+                step2 = step1 / var2;
+                step3 = screen->h / var1;
+                step4 = step1 / var2;
+
+                for(i = 0; i <= var2; i++) {
+                    for(j = 0; j <= var1; j++) {
+                        x1 = step1 * (j - 0.5) - i * step2 + 1;
+                        x2 = step1 * (j - 0.5) + i * step2 + 1;
+                        src.x = x1;
+                        src.y = 0;
+                        src.w = step2;
+                        src.h = screen->h;
+                        dst.x = x2;
+                        dst.y = 0;
+                        dst.w = step2;
+                        dst.h = screen->h;
+                        SDL_BlitSurface(newbkg, &src, screen, &src);
+                        SDL_BlitSurface(newbkg, &dst, screen, &dst);
+                        AddRect(&src, &src);
+                        AddRect(&dst, &dst);
+                        y1 = step3 * (j - 0.5) - i * step4 + 1;
+                        y2 = step3 * (j - 0.5) + i * step4 + 1;
+                        src.x = 0;
+                        src.y = y1;
+                        src.w = screen->w;
+                        src.h = step4;
+                        dst.x = 0;
+                        dst.y = y2;
+                        dst.w = screen->w;
+                        dst.h = step4;
+                        SDL_BlitSurface(newbkg, &src, screen, &src);
+                        SDL_BlitSurface(newbkg, &dst, screen, &dst);
+                        AddRect(&src, &src);
+                        AddRect(&dst, &dst);
+                    }
+                    UpdateScreen(&frame);
+                }
+
+                src.x = 0;
+                src.y = 0;
+                src.w = screen->w;
+                src.h = screen->h;
+                SDL_BlitSurface(newbkg, NULL, screen, &src);
+                SDL_Flip(screen);
+
+                break;
+            } default:
+                break;
+        }
+    }
+    return 1;
+}
+
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Private" functions (local to playgame.c)                    */
+/*                                                                      */
+/************************************************************************/
+
+
+
+static int check_word( int f ) {
+	int i;
+
+	if (wcslen(fish_object[f].word) > tux_object.wordlen) 
+		return 0;
+
+	for (i=0; i < wcslen(fish_object[f].word); i++) 
+		if (fish_object[f].word[i] != tux_object.word[tux_object.wordlen -                                           wcslen(fish_object[f].word) + i])
+			return 0;
+
+	return 1;
+}
+
+
+
+
+
+
+
+
+
+
+/***************************************
+	WaitFrame: wait for the next frame
+***************************************/
+void WaitFrame(void) {
+	static Uint32  next_tick = 0;
+	Uint32         this_tick = SDL_GetTicks();
+
+	if (this_tick < next_tick)
+		SDL_Delay(next_tick - this_tick);
+
+	next_tick = this_tick + (1000 / FRAMES_PER_SEC);
+}
+
+
+/****************************************************
+ ResetObjects : Clear and reset all objects to dead
+****************************************************/
+
+static void ResetObjects( void ) {
+	int i;
+
+	LOG( "RESETTING OBJECTS\n" );
+
+	for (i = 0; i < MAX_FISHIES_HARD + 1; i++) {
+		fish_object[i] = null_fishy;
+		splat_object[i] = null_splat;
+	}
+
+	tux_object.facing = RIGHT;
+	tux_object.x = screen->w / 2;
+	tux_object.y = screen->h - tux_object.spr[0][RIGHT]->frame[0]->h - 1;
+	tux_object.dx = 0;
+	tux_object.dy = 0;
+	tux_object.endx = tux_object.x;
+	tux_object.endy = tux_object.y;
+	tux_object.state = TUX_STANDING;
+	tux_object.word[0] = 0;
+	tux_object.wordlen = 0;
+
+	LOG( "OBJECTS RESET\n" );
+}
+
+static int DrawSprite(sprite* gfx, int x, int y)
+{
+  struct blit* update;
+
+  if (!gfx)
+  {
+    fprintf(stderr, "DrawSprite() - 'gfx' arg invalid!\n");
+    return 0;
+  }
+
+  update = &blits[numupdates++];
+
+  if(!update || !update->srcrect || !update->dstrect)
+  {
+    fprintf(stderr, "DrawSprite() - 'update' ptr invalid!\n");
+    return 0;
+  }
+
+  update->src = gfx->frame[gfx->cur];
+  update->srcrect->x = 0;
+  update->srcrect->y = 0;
+  update->srcrect->w = gfx->frame[gfx->cur]->w;
+  update->srcrect->h = gfx->frame[gfx->cur]->h;
+  update->dstrect->x = x;
+  update->dstrect->y = y;
+  update->dstrect->w = gfx->frame[gfx->cur]->w;
+  update->dstrect->h = gfx->frame[gfx->cur]->h;
+  update->type = 'D';
+
+  return 1;
+}
+
+/**********************
+DrawObject : Draw an object at the specified
+location. No respect to clipping!
+*************************/
+static int DrawObject(SDL_Surface* surf, int x, int y)
+{
+  struct blit *update;
+
+  if (!surf)
+  {
+    fprintf(stderr, "DrawObject() - invalid 'surf' arg!\n");
+    return 0;
+  }
+
+  update = &blits[numupdates++];
+
+  if(!update || !update->srcrect || !update->dstrect)
+  {
+    fprintf(stderr, "DrawObject() - 'update' ptr invalid!\n");
+    return 0;
+  }
+
+  update->src = surf;
+  update->srcrect->x = 0;
+  update->srcrect->y = 0;
+  update->srcrect->w = surf->w;
+  update->srcrect->h = surf->h;
+  update->dstrect->x = x;
+  update->dstrect->y = y;
+  update->dstrect->w = surf->w;
+  update->dstrect->h = surf->h;
+  update->type = 'D';
+
+  return 1;
+}
+
+/************************
+UpdateScreen : Update the screen and increment the frame num
+***************************/
+static void UpdateScreen(int* frame)
+{
+	int i;
+
+	/* -- First erase everything we need to -- */
+	for (i = 0; i < numupdates; i++)
+		if (blits[i].type == 'E') 
+			SDL_LowerBlit(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
+	SNOW_erase();
+
+	/* -- then draw -- */ 
+	for (i = 0; i < numupdates; i++)
+		if (blits[i].type == 'D') 
+			SDL_BlitSurface(blits[i].src, blits[i].srcrect, screen, blits[i].dstrect);
+	SNOW_draw();
+
+	/* -- update the screen only where we need to! -- */
+	if (SNOW_on) 
+		SDL_UpdateRects(screen, SNOW_add( (SDL_Rect*)&dstupdate, numupdates ), SNOW_rects);
+	else 
+		SDL_UpdateRects(screen, numupdates, dstupdate);
+
+	numupdates = 0;
+	*frame = *frame + 1;
+}
+
+static int EraseSprite(sprite* img, int x, int y)
+{
+  struct blit* update;
+
+  if(!img)
+  {
+    fprintf(stderr, "EraseSprite() - invalid 'img' arg!\n");
+    return 0;
+  }
+
+  update = &blits[numupdates++];
+
+  if(!update || !update->srcrect || !update->dstrect)
+  {
+    fprintf(stderr, "EraseSprite() - 'update' ptr invalid!\n");
+    return 0;
+  }
+
+  update->src = background;
+  update->srcrect->x = x;
+  update->srcrect->y = y;
+  update->srcrect->w = img->frame[img->cur]->w;
+  update->srcrect->h = img->frame[img->cur]->h;
+
+  /* check to see if we are trying blit data that doesn't exist!!! */
+
+  if (update->srcrect->x + update->srcrect->w > background->w)
+    update->srcrect->w = background->w - update->srcrect->x;
+  if (update->srcrect->y + update->srcrect->h > background->h)
+    update->srcrect->h = background->h - update->srcrect->y;
+
+  update->dstrect->x = x;
+  update->dstrect->y = y;
+  update->dstrect->w = update->srcrect->w;
+  update->dstrect->h = update->srcrect->h;
+  update->type = 'E';
+
+  return 1;
+}
+
+/*************************
+EraseObject : Erase an object from the screen
+**************************/
+static int EraseObject(SDL_Surface* surf, int x, int y)
+{
+  struct blit *update;
+
+  if(!surf)
+  {
+    fprintf(stderr, "EraseObject() - invalid 'surf' arg!\n");
+    return 0;
+  }
+
+  update = &blits[numupdates++];
+
+  if(!update || !update->srcrect || !update->dstrect)
+  {
+    fprintf(stderr, "EraseObject() - 'update' ptr invalid!\n");
+    return 0;
+  }
+
+  update->src = background;
+  update->srcrect->x = x;
+  update->srcrect->y = y;
+  update->srcrect->w = surf->w;
+  update->srcrect->h = surf->h;
+
+  /* check to see if we are trying blit data that doesn't exist!!! */
+
+  if (update->srcrect->x + update->srcrect->w > background->w)
+    update->srcrect->w = background->w - update->srcrect->x;
+  if (update->srcrect->y + update->srcrect->h > background->h)
+    update->srcrect->h = background->h - update->srcrect->y;
+
+  update->dstrect->x = x;
+  update->dstrect->y = y;
+  update->dstrect->w = update->srcrect->w;
+  update->dstrect->h = update->srcrect->h; 
+  update->type = 'E';
+
+  return 1;
+}
+
+
+/******************************
+AddRect : Dont actually blit a surface,
+    but add a rect to be updated next
+    update
+*******************************/
+static int AddRect(SDL_Rect* src, SDL_Rect* dst)
+{
+
+  /*borrowed from SL's alien (and modified)*/
+  struct blit* update;
+
+  if(!src)
+  {
+    fprintf(stderr, "AddRect() - invalid 'src' arg!\n");
+    return 0;
+  }
+
+  if(!dst)
+  {
+    fprintf(stderr, "AddRect() - invalid 'dst' arg!\n");
+    return 0;
+  }
+
+  update = &blits[numupdates++];
+
+  if(!update || !update->srcrect || !update->dstrect)
+  {
+    fprintf(stderr, "AddRect() - 'update' ptr invalid!\n");
+    return 0;
+  }
+
+  update->srcrect->x = src->x;
+  update->srcrect->y = src->y;
+  update->srcrect->w = src->w;
+  update->srcrect->h = src->h;
+  update->dstrect->x = dst->x;
+  update->dstrect->y = dst->y;
+  update->dstrect->w = dst->w;
+  update->dstrect->h = dst->h;
+  update->type = 'I';
+
+  return 1;
+}
+
+/*********************
+LoadOthers : Load all other graphics
+**********************/
+static void LoadOthers(void)
+{
+	int i;
+	unsigned char filename[FNLEN];
+
+	LOG( "=LoadOthers()\n" );
+	DEBUGCODE
+	{
+	  fprintf(stderr, "settings.theme_font_name is %s\n",
+                  settings.theme_font_name);
+	}
+	font = LoadFont(settings.theme_font_name, GAME_FONT_SIZE);
+
+	curlev = BlackOutline(_("Level"), font, &white);
+	lives  = BlackOutline(_("Lives"), font, &white);
+	fish   = BlackOutline(_("Fish"), font, &white);
+
+	level[0] = BlackOutline(_("Easy"), font, &white);
+	level[1] = BlackOutline(_("Medium"), font, &white);
+	level[2] = BlackOutline(_("Hard"), font, &white);
+	level[3] = BlackOutline(_("Practice"), font, &white);
+
+	number_max_w = 0;
+	for (i = 0; i < NUM_NUMS; i++) {
+		sprintf(filename, "num_%i.png", i);
+		number[i] = LoadImage( filename, IMG_COLORKEY );
+		if (number[i]->w > number_max_w)
+			number_max_w = number[i]->w;
+	}
+
+	for (i = 0; i < CONGRATS_FRAMES; i++) {
+		congrats[i] = BlackOutline(_("Congratulations"), font, &white);
+	}
+
+	for (i = 0; i < OH_NO_FRAMES; i++) {
+		ohno[i] = BlackOutline(_("Oh No!"), font, &white);
+	}
+	
+	if (settings.sys_sound) {
+		LOG( "=Loading Sound FX\n" );
+
+		sound[WIN_WAV] = LoadSound( "win.wav" );
+		sound[WINFINAL_WAV] = LoadSound( "winfinal.wav" );
+		sound[BITE_WAV] = LoadSound( "bite.wav" );
+		sound[LOSE_WAV] = LoadSound( "lose.wav" );
+		sound[RUN_WAV] = LoadSound( "run.wav" );
+		sound[SPLAT_WAV] = LoadSound( "splat.wav" );
+		sound[EXCUSEME_WAV] = LoadSound( "excuseme.wav" );
+
+		LOG( "=Done Loading Sound FX\n" );
+	} else 
+		LOG( "=NO SOUND FX LOADED (not selected)\n" );
+
+//	PauseLoadMedia();
+
+	LOG( "=Setting NULL fish & splat & word\n" );
+
+	null_fishy.alive = 0;
+	null_fishy.can_eat = 0;
+	null_fishy.word = NULL;
+	null_fishy.x = 0;
+	null_fishy.y = 0;
+	null_fishy.dy = 0;
+
+	null_splat.x = 0;
+	null_splat.y = 0;
+	null_splat.alive = 0;
+
+	LOG( "=LoadOthers() END\n" );
+}
+
+static void display_msg(const unsigned char* msg, int x, int y)
+{
+	SDL_Surface* m;
+	m = TTF_RenderUTF8_Shaded(font, msg, white, white);
+	EraseObject(m, x, y);
+	DrawObject(m, x, y);
+	SDL_FreeSurface(m);
+}
+
+/***************************
+LoadFishies : Load the fish animations and graphics
+*****************************/
+static void LoadFishies(void)
+{
+	int i;
+
+	LOG( "=LoadFishies()\n" );
+
+	fishy = LoadSprite( "fishy", IMG_COLORKEY );
+	splat = LoadSprite( "splat", IMG_COLORKEY );
+
+	for (i = 0; i < MAX_FISHIES_HARD; i++) {
+		fish_object[i].alive = 1;
+		fish_object[i].can_eat = 0;
+		splat_object[i].alive = 0;
+	}
+
+	LOG( "=LoadFishies(): END\n" );
+}
+
+/******************************
+LoadTuxAnims : Load the Tux graphics and animations
+*******************************/
+static void LoadTuxAnims(void)
+{
+	int i;
+	int height = 0;                //temp width/height varis to determine max's
+
+	LOG( "=LoadTuxAnims(): Loading Tux Animations\n" );
+
+	for ( i=0; i < TUX_NUM_STATES; i++ ) {
+		tux_object.spr[i][RIGHT] = LoadSprite( tux_sprite_fns[i], IMG_COLORKEY ); 
+		tux_object.spr[i][LEFT] = FlipSprite( tux_object.spr[i][RIGHT], 1, 0 ); 
+	}
+
+	tux_max_width = tux_object.spr[TUX_STANDING][RIGHT]->frame[0]->w;
+	height        = tux_object.spr[TUX_STANDING][RIGHT]->frame[0]->h;
+
+	LOG( "=LoadTuxAnims(): END\n" );
+}
+
+/******************************
+DrawNumbers : Draw numbers at
+a certain x,y. See "usage"
+below
+*******************************/
+static void DrawNumbers(int num, int x, int y, int places)
+{
+//usage:
+//      num    = number to draw onscreen
+//      x, y   = coords to place number (starting upper left)
+//      places = number of places to fit it into (i.e., if
+//                                       number = 5 and places = 2, would draw "05")
+//                                       if places = 0, then will simply display as
+//                                       many as necessary
+    unsigned char numnuts[FNLEN];
+    int needed_places, i;
+    int uddernumber;
+
+    sprintf(numnuts, "%d", num);
+    i = 0;
+    needed_places = strlen(numnuts);
+
+    if (needed_places < FNLEN && needed_places <= places) {
+        if (places > 0) {
+            for (i = 1; i <= (places - needed_places); i++) {
+                DrawObject(number[0], x, y);
+                x += number[0]->w;
+            }
+        }
+    }
+    for (i = 0; i < needed_places; i++) {
+        uddernumber = numnuts[i] - '0';
+
+        DrawObject(number[uddernumber], x, y);
+        x += number[uddernumber]->w;
+    }
+}
+
+/*************************
+EraseNumbers: Erase numbers
+from the screen. See "usage"
+*****************************/
+static void EraseNumbers(int num, int x, int y, int places)
+{
+//usage:
+//      num    = number to draw onscreen
+//      x, y   = coords to place number (starting upper left)
+//      places = number of places to fit it into (i.e., if
+//                                       number = 5 and places = 2, would draw "05")
+//                                       if places = 0, then will simply display as
+//                                       many as necessary
+    unsigned char numnuts[FNLEN];
+    int needed_places, i;
+    int uddernumber;
+
+    sprintf(numnuts, "%d", num);
+    i = 0;
+    needed_places = strlen(numnuts);
+
+    if (needed_places < FNLEN && needed_places <= places) {
+        if (places > 0) {
+            for (i = 1; i <= (places - needed_places); i++) {
+                EraseObject(number[0], x, y);
+                x += number[0]->w;
+            }
+        }
+    }
+    for (i = 0; i < needed_places; i++) {
+        uddernumber = numnuts[i] - '0';
+        EraseObject(number[uddernumber], x, y);
+        x += number[uddernumber]->w;
+    }
+}
+
+/**********************
+FreeGame : Free all
+the game elements
+***********************/
+static void FreeGame(void)
+{
+	int i;
+
+	FreeLetters();
+
+	TTF_CloseFont(font);
+        font = NULL;
+
+	LOG( "FreeGame():\n-Freeing Tux Animations\n" );
+
+	for ( i=0; i < TUX_NUM_STATES; i++ ) {
+		FreeSprite(tux_object.spr[i][RIGHT]);
+		FreeSprite(tux_object.spr[i][LEFT]);
+		tux_object.spr[i][RIGHT] = NULL;
+		tux_object.spr[i][LEFT] = NULL;
+	}
+
+	LOG( "-Freeing fishies\n" );
+
+	FreeSprite( fishy );
+	FreeSprite( splat );
+        fishy = splat = NULL;
+
+	LOG( "-Freeing other game graphics\n" );
+
+	SDL_FreeSurface(background);
+	SDL_FreeSurface(curlev);
+	SDL_FreeSurface(fish);
+	SDL_FreeSurface(lives);
+        background = curlev = fish = lives = NULL;
+
+	for (i = 0; i < NUM_LEVELS; i++)
+	{
+          SDL_FreeSurface(level[i]);
+	  level[i] = NULL;
+        }
+	for (i = 0; i < NUM_NUMS; i++)
+	{
+	  SDL_FreeSurface(number[i]);
+	  number[i] = NULL;
+	}
+	for (i = 0; i < CONGRATS_FRAMES; i++)
+	{
+	  SDL_FreeSurface(congrats[i]);
+	  congrats[i] = NULL;
+	}
+	for (i = 0; i < OH_NO_FRAMES; i++)
+	{
+	  SDL_FreeSurface(ohno[i]);
+	  ohno[i] = NULL;
+	}
+	if (settings.sys_sound) {
+	  LOG( "-Freeing sound\n" );
+	  for (i = 0; i < NUM_WAVES; ++i)
+          {
+	    Mix_FreeChunk(sound[i]);
+            sound[i] = NULL;
+	  }
+	}
+
+//	PauseUnloadMedia();
+
+
+	LOG( "FreeGame(): END\n" );
+}
+
+/***************************
+DrawBackground : This
+function updates the entire
+background. Usefull when
+loading new backgrounds,
+or clearing game screen
+****************************/
+static void DrawBackground(void)
+{
+    struct blit *update;
+
+    LOG("-DrawBackground(): Updating entire background\n");
+
+    numupdates=0;  // drawing entire background writes over all other stuff, so don't draw them
+
+    update = &blits[numupdates++];
+    update->src = background;
+
+    update->srcrect->x = update->dstrect->x = 0;
+    update->srcrect->y = update->dstrect->y = 0;
+    update->srcrect->w = update->dstrect->w = background->w;
+    update->srcrect->h = update->dstrect->h = background->h;
+
+    update->type = 'D';
+}
+
+/****************************
+SpawnFishies: Spawn the fishes
+in the key cascade game
+*****************************/
+static void SpawnFishies(int diflevel, int* fishies, int* frame)
+{
+	int i, spacing;
+	wchar_t* new_word;
+
+	switch (diflevel) {
+		case INF_PRACT:
+		case EASY:   spacing = FISH_SPACING_EASY; break;
+		case MEDIUM: spacing = FISH_SPACING_MEDIUM; break;
+		case HARD:   spacing = FISH_SPACING_HARD; break;
+	}
+
+	/* --- return without spawn if there isn't room yet --- */
+
+	for (i = 0; i < *fishies; i++)
+		if (fish_object[i].y < (fishy->frame[0]->h + spacing))
+			return;
+
+	/* See if we get a valid UTF-8 word from WORDS_get before we move on: */
+	/* Now that we are using UTF-8, some characters may be more than one byte, */
+	/* so we can't just use strlen() anymore - DSB.*/		
+	LOG( "=>Spawning fishy\n" );
+
+	new_word = GetWord();
+
+	if (!new_word)
+	{
+	  fprintf(stderr, "SpawnFishies() - could not get word - returning.\n");
+          return;
+	}
+
+	/* If we get to here, it should be OK to actually spawn the fishy: */
+	fish_object[*fishies].word = new_word;
+        fish_object[*fishies].len = wcslen(new_word);
+	fish_object[*fishies].alive = 1;
+	fish_object[*fishies].can_eat = 0;
+	fish_object[*fishies].w = fishy->frame[0]->w * fish_object[*fishies].len;
+	fish_object[*fishies].x = rand() % (screen->w - fish_object[*fishies].w);
+	fish_object[*fishies].y = 0;
+
+	/* set the percentage of the speed based on length */
+	fish_object[*fishies].dy = pow(0.92,fish_object[*fishies].len-1);
+	/* ex: a 9 letter word will be roughly twice as slow! 0.92^8 */
+
+	/* give it a random variance so the fish "crunch" isn't constant */
+	fish_object[*fishies].dy *= ((75 + rand() % 25)/100.0);
+	switch (diflevel) {
+		case INF_PRACT:
+			fish_object[*fishies].dy = DEFAULT_SPEED;
+			break;
+		case EASY:
+			fish_object[*fishies].dy *= MAX_SPEED_EASY;
+			break;
+		case MEDIUM:
+			fish_object[*fishies].dy *= MAX_SPEED_MEDIUM;
+			break;
+		case HARD:
+			fish_object[*fishies].dy *= MAX_SPEED_HARD;
+			break;
+   	}
+
+	fish_object[*fishies].splat_time = *frame + (480 - fishy->frame[0]->h - tux_object.spr[TUX_STANDING][0]->frame[0]->h)/fish_object[*fishies].dy;
+
+	DEBUGCODE {
+		/* NOTE need %S rather than %s because of wide characters */
+		fprintf(stderr, "Spawn fishy with word '%S'\n", fish_object[*fishies].word);
+		fprintf(stderr, "Byte length is: %d\n", wcslen(fish_object[*fishies].word));
+		fprintf(stderr, "UTF-8 char length is: %d\n", fish_object[*fishies].len);
+	}
+
+	*fishies = *fishies + 1;
+}
+
+/***************************
+CheckFishies : Check all the fishies and splats.
+               sort the splats and fishies
+****************************/
+static void CheckFishies(int* fishies, int* splats)
+{
+	int forward, backward;
+	struct fishypoo fish_temp;
+	struct splatter splat_temp;
+
+//	LOG( "CheckFishies\n" );
+
+	/* move any fish from the rear to fill up gaps in the
+	 * front
+	 */
+	forward = 0;
+	backward = MAX_FISHIES_HARD;
+	while (forward < backward) {
+		while (backward > 0 && !fish_object[backward].alive)
+			backward--;
+		while (forward < backward && fish_object[forward].alive)
+			forward++;
+		if ((fish_object[backward].alive) && (!fish_object[forward].alive)) {
+			/* swap alive to be infront of dead */
+			fish_temp = fish_object[backward];
+			fish_object[backward] = fish_object[forward];
+			fish_object[forward] = fish_temp;
+		}
+	}
+	
+	/* same thing for splats */
+
+	forward = 0;
+	backward = MAX_FISHIES_HARD;
+	while (forward < backward) {
+		while (backward > 0 && !splat_object[backward].alive)
+			backward--;
+		while (forward < backward && splat_object[forward].alive)
+			forward++;
+		if ((splat_object[backward].alive) && (!splat_object[forward].alive)) {
+			/* swap alive to be infront of dead */
+			splat_temp = splat_object[backward];
+			splat_object[backward] = splat_object[forward];
+			splat_object[forward] = splat_temp;
+		}
+	}
+
+	/* update the count for fishies & splats */
+
+	*splats = *fishies = 0;
+
+	for (forward = 0; forward < MAX_FISHIES_HARD; forward++)
+		if (fish_object[forward].alive)
+			*fishies+=1;
+		else
+			break;
+
+	for (forward = 0; forward < MAX_FISHIES_HARD; forward++)
+		if (splat_object[forward].alive)
+			*splats+=1;
+		else
+			break;
+}
+
+// Restrict x to a value in the range from a ... b
+static int int_restrict(int a, int x, int b) {
+	if (x < a) x = a;
+	if (x > b) x = b;
+	return x;
+}
+
+static float float_restrict(float a, float x, float b)
+{
+	if (x < a) x = a;
+	if (x > b) x = b;
+	return x;
+}
+
+/***************************
+AddSplat: A fish has died, add a splat where he used to be
+****************************/
+static void AddSplat(int* splats, struct fishypoo* f, int* curlives, int* frame) {
+	int i;
+
+	for ( i = 0; i < f->len; i++ ) {
+		splat_object[*splats].x = int_restrict( 0, f->x+(fishy->frame[0]->w*i) + ((fishy->frame[fishy->cur]->w)>>1)-((splat->frame[0]->w)>>1), screen->w-splat->frame[0]->h-1 );
+		splat_object[*splats].y = screen->h - splat->frame[0]->h - 1;
+		splat_object[*splats].alive = 10; // JA tweak here! frames of live of the splat
+		*splats = *splats + 1;
+	}
+
+	f->alive = 0;
+
+	*curlives = *curlives - 1;
+	if (*curlives <= 0)
+		*curlives = 0;
+
+	if ( settings.sys_sound ) 
+		Mix_PlayChannel(SPLAT_WAV, sound[SPLAT_WAV], 0);
+}
+
+
+
+
+static void DrawFish(int which)
+{
+/*        LOG ("Entering DrawFish()\n");*/
+	int j = 0;
+	int red_letters = 0;
+	int current_letter;
+	/* 'x_inset' and 'y_inset' are where the glyph to be drawn relative        */
+	/* the fishy graphic:                                                      */
+	const int x_inset = 10;
+        const int y_inset = 10;
+	/* letter_x and letter_y are where the upper left corner of the glyph needs */
+        /* to be located - (e.g. how SDL blitting understands locations)           */
+        int letter_x = 0;
+        int letter_y = 0;
+
+        SDL_Surface* letter_surface;
+
+	/* Make sure needed pointers are valid - if not, return: */
+        if (!fishy || !fishy->frame[0])
+	{
+          fprintf(stderr, "DrawFish() - returning, needed pointer invalid\n");
+          return;
+	}
+	    
+
+
+	/* Draw the fishies: */
+	for (j = 0; j < fish_object[which].len; j++)
+        {
+	  DrawSprite( fishy,
+                      fish_object[which].x + (fishy->frame[0]->w*j),
+                      fish_object[which].y);
+        }
+
+
+	/* Now we draw the letters on top of the fish: */
+	/* we only draw the letter if tux cannot eat it yet */
+	if (!fish_object[which].can_eat)
+	{
+		red_letters = -1;
+		j = 0;
+
+		/* figure out how many letters are red: */
+		while (j < tux_object.wordlen && red_letters == -1)
+		{
+		  int k;
+		  for (k = 0; k < tux_object.wordlen - j; k++)
+                  {
+                    if (fish_object[which].word[k] != tux_object.word[j + k]) 
+                      k = 100000;
+                  }
+
+                  if (k < 100000)
+                    red_letters = tux_object.wordlen - j;	
+                  else
+                    j++;
+		}
+	
+// 		LOG ("Preparing to draw letters:\n");
+
+		/* Now draw each letter: */
+		for (j = 0; j < wcslen(fish_object[which].word); j++)
+		{
+		  current_letter = (int)fish_object[which].word[j];
+
+		  if (j < red_letters)
+                    letter_surface = GetRedGlyph(current_letter);
+                  else
+                    letter_surface = GetWhiteGlyph(current_letter);
+
+		  /* Set "letter_x" and "letter_y to where we want the letter drawn: */
+		  letter_x = fish_object[which].x + (j * fishy->frame[0]->w) + x_inset;
+		  letter_y = fish_object[which].y + y_inset;
+
+		  DrawObject(letter_surface, letter_x, letter_y);
+		}
+	}
+/*        LOG ("Leaving DrawFish()\n");*/
+}
+
+/****************************
+MoveFishies : Display and
+move the fishies according
+to their settings
+*****************************/
+static void MoveFishies(int *fishies, int *splats, int *lifes, int *frame) {
+	int i, j;
+
+//	LOG("start MoveFishies\n");
+
+	for (i = 0; i < *fishies; i++)
+		if (fish_object[i].alive) {
+			for (j=0; j < fish_object[i].len; j++)
+				EraseSprite( fishy, fish_object[i].x + (fishy->frame[0]->w*j), fish_object[i].y );
+	            
+			fish_object[i].y += fish_object[i].dy;
+	
+			if (fish_object[i].y >= (screen->h) - fishy->frame[fishy->cur]->h - 1) 
+				AddSplat( splats, &fish_object[i], lifes, frame );
+		}
+	
+	for (i = 0; i < *fishies; i++)
+		if (fish_object[i].alive && fish_object[i].can_eat) 
+			DrawFish( i );
+
+	for (i = 0; i < *fishies; i++)
+		if (fish_object[i].alive && !fish_object[i].can_eat) 
+			DrawFish( i );
+
+	for (i = 0; i < *splats; i++) 
+		if (splat_object[i].alive) {
+			splat_object[i].alive--;
+			if (splat_object[i].alive>1)
+					DrawSprite( splat, splat_object[i].x, splat_object[i].y);
+				else 
+					EraseSprite( splat, splat_object[i].x, splat_object[i].y);
+		}
+
+//	LOG("end MoveFishies\n");
+}
+
+/* UpdateTux : anytime a key is pressed, we need check to
+ * see if a fish can be eaten.  The fish that could hit
+ * the bottom of the screen first should be choosen if 
+ * two fishies match what is typed
+ */
+void UpdateTux(wchar_t letter_pressed, int fishies, int frame) {
+	int i;
+	int time_it_splats=0;
+	int which=-1;
+
+	/* --- move our word array to make room if needed --- */
+
+	if (tux_object.wordlen == MAX_WORD_SIZE) {
+		for (i = 0; i < MAX_WORD_SIZE; i++) 
+			tux_object.word[i] = tux_object.word[i + 1];
+		tux_object.wordlen--;
+	}
+
+	/* --- add letter pressed to word array --- */
+
+	tux_object.word[tux_object.wordlen] = letter_pressed;
+	tux_object.wordlen++;
+	tux_object.word[tux_object.wordlen] = 0;
+
+	/* choose the word that matchs what has been typed  */
+	/* and will hit the ground first                    */
+	for (i = 0; i < fishies; i++) 
+		if ((fish_object[i].alive && !fish_object[i].can_eat) && check_word(i) && (time_it_splats > fish_object[i].splat_time || !time_it_splats)) {
+			time_it_splats = fish_object[i].splat_time;
+			which = i;
+		}
+
+	if (which!=-1) {
+		fish_object[which].can_eat = 1;
+		tux_object.wordlen = 0;
+		tux_object.word[0] = 0;
+	}
+
+}
+
+/*************************
+CheckCollision: Check
+for collisions between Tux
+and Fishies. If collided,
+perform appropriate action
+***************************/
+static void CheckCollision(int fishies, int *fish_left, int frame ) {
+	int i, j;
+
+//	LOG( "start CheckCollision\n" );
+
+	for (i = 0; i < fishies; i++) {
+		if ((fish_object[i].y >= tux_object.y - fishy->frame[0]->h) &&
+		    (fish_object[i].x + (fish_object[i].w-fishy->frame[0]->w)/2 >= tux_object.x) &&
+		    (fish_object[i].x + (fish_object[i].w+fishy->frame[0]->w)/2 <= tux_object.x + tux_max_width)) {
+
+			if (fish_object[i].can_eat) {
+                		LOG( "**EATING A FISHY** - in CheckCollision()\n" );
+
+				fish_object[i].alive = 0;
+				fish_object[i].can_eat = 0;
+
+				for (j = 0; j < fish_object[i].len; j++) 
+					EraseSprite(fishy, (fish_object[i].x + (j * fishy->frame[0]->w)), fish_object[i].y);
+
+				*fish_left = *fish_left - 1;
+
+				tux_object.state = TUX_GULPING;
+				REWIND(tux_object.spr[TUX_GULPING][tux_object.facing]);
+				tux_object.dx = 0;
+				tux_object.endx = tux_object.x;
+
+				if (settings.sys_sound) Mix_PlayChannel(BITE_WAV, sound[BITE_WAV], 0);
+
+			} else if (tux_object.state == TUX_STANDING) {
+				LOG( "***EXCUSE ME!** - in CheckCollision()\n" );
+
+				if (settings.sys_sound && !Mix_Playing(EXCUSEME_WAV))
+					Mix_PlayChannel(EXCUSEME_WAV, sound[EXCUSEME_WAV], 0);
+			}
+		}
+	}
+//	LOG( "end CheckCollision\n" );
+}
+
+static void next_tux_frame(void) {
+
+	if ( tux_object.state != TUX_GULPING ) {
+		NEXT_FRAME(tux_object.spr[tux_object.state][tux_object.facing]);
+	} else {
+		NEXT_FRAME(tux_object.spr[TUX_GULPING][tux_object.facing]);
+		if (tux_object.spr[TUX_GULPING][tux_object.facing]->cur==0) 
+			tux_object.state = TUX_STANDING;
+	}
+}
+
+/***********************************
+MoveTux : Update Tux's location & then blit him!
+************************************/
+static void MoveTux( int frame, int fishies ) {
+	int i;
+	int which=-1, time_to_splat=0;
+
+//	LOG( "MoveTux\n" );
+
+	EraseSprite( tux_object.spr[tux_object.state][tux_object.facing], tux_object.x, tux_object.y );
+
+	if (tux_object.state != TUX_GULPING) {
+		for (i=0; i<fishies; i++) 
+			if (fish_object[i].can_eat && (!time_to_splat || fish_object[i].splat_time < time_to_splat)) {
+				time_to_splat = fish_object[i].splat_time;
+				which = i;
+			}
+		if (which != -1) {
+			int endx = int_restrict( 0, fish_object[which].x + (fish_object[which].w/2) - (tux_object.spr[TUX_GULPING][RIGHT]->frame[0]->w / 2), screen->w - tux_max_width - 1 );
+			if (endx != tux_object.endx) {
+				tux_object.endx = endx;
+
+				if (tux_object.endx >= tux_object.x)
+					tux_object.facing = RIGHT;
+				else
+					tux_object.facing = LEFT;
+
+				/* see how fast we need to go to get there... */
+				if (time_to_splat - frame > (abs(tux_object.endx - tux_object.x) / WALKING_SPEED)) {
+					tux_object.dx = WALKING_SPEED;
+					tux_object.state = TUX_WALKING;
+
+					//stop running sound (if playing)                                               
+					if (settings.sys_sound && Mix_Playing(RUN_WAV))
+						Mix_HaltChannel(RUN_WAV);
+				} else {
+					if (time_to_splat > frame) 
+						tux_object.dx = float_restrict( MIN_RUNNING_SPEED, abs(tux_object.endx - tux_object.x) / (time_to_splat-frame), MAX_RUNNING_SPEED );
+					else {
+						tux_object.dx = MAX_RUNNING_SPEED;
+						if (settings.sys_sound && !Mix_Playing(RUN_WAV))
+							if (abs(tux_object.endx - tux_object.x) > 50)
+								Mix_PlayChannel(RUN_WAV, sound[RUN_WAV], 0);
+					}
+
+					tux_object.state = TUX_RUNNING;
+				}
+			}
+		}
+	}
+
+	/* --- move tux (if moving) --- */
+	
+	tux_object.x = float_restrict(0, tux_object.x + (tux_object.facing==RIGHT ? 1.0 : -1.0)*tux_object.dx, (screen->w - tux_max_width));
+
+	/* if done with certain frames, then reset to standing */
+
+	if (tux_object.state == TUX_WALKING || tux_object.state == TUX_RUNNING) {
+		if ((tux_object.facing == RIGHT && tux_object.x >= tux_object.endx) ||
+		    (tux_object.facing == LEFT && tux_object.x <= tux_object.endx)) {
+
+			LOG( "-In MoveTux(): returning tux to standing\n" );
+			tux_object.state = TUX_STANDING;
+			tux_object.dx = 0;
+			tux_object.x = tux_object.endx;
+		}
+	}
+
+	if ((frame % 8) == 0) next_tux_frame();
+}
+
+static void draw_bar(int curlevel, int diflevel, int curlives, int oldlives, int fish_left, int oldfish_left) {
+	/* --- draw difficulty --- */
+
+	DrawObject(level[diflevel], 1, 1);
+
+	/* --- draw level --- */
+	DrawObject(curlev, 1 + GRAPHIC_SPACE + level[diflevel]->w, 1);
+	DrawNumbers(curlevel + 1, 1 + 2 * GRAPHIC_SPACE + level[diflevel]->w + curlev->w, 1, 0);
+
+	/* --- draw lives --- */
+	DrawObject(lives, (screen->w) - (1+lives->w+fish->w+((MAX_FISHIES_DIGITS+1)*2*number_max_w)+GRAPHIC_SPACE), 1);
+
+	if (oldlives != curlives) {
+		EraseNumbers(oldlives, (screen->w) - (1+fish->w+((MAX_FISHIES_DIGITS+1)*2*number_max_w)+GRAPHIC_SPACE), 1, 0);
+		oldlives = curlives;
+	}
+
+	DrawNumbers(curlives, (screen->w) - (1 + fish->w + ((MAX_FISHIES_DIGITS + 1) * 2 * number_max_w) + GRAPHIC_SPACE), 1, 0);
+
+	/* --- draw fish left --- */
+	DrawObject(fish, (screen->w) - (1 + fish->w + (MAX_FISHIES_DIGITS * number_max_w)), 1);
+	if (oldfish_left != fish_left) {
+		EraseNumbers(oldfish_left, (screen->w) - (1 + (MAX_FISHIES_DIGITS * number_max_w)), 1, MAX_FISHIES_DIGITS);
+		oldfish_left = fish_left;
+	}
+	DrawNumbers(fish_left, (screen->w) - (1 + (MAX_FISHIES_DIGITS * number[4]->w)), 1, MAX_FISHIES_DIGITS);
+}
+
+
+
+
+
+
+

Added: tuxtype/branches/tuxtype-reorg/src/playgame.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/playgame.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/playgame.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,141 @@
+/***************************************************************************
+                          playgame.h
+  description:
+                             -------------------
+    begin                : Fri May 12 2000
+    copyright            : (C) 2000 by Sam Hart
+    email                : hart at geekcomix.com
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef __PLAYGAME_H__
+#define __PLAYGAME_H__
+
+//definitions
+#define GRAPHIC_SPACE 4 //space between each status bar element in cascade
+
+#define NUM_NUMS 10	//"Mmmmm....Num-Nums...."
+
+#define CONGRATS_FRAMES	2	//number of frames for congrats animation
+#define OH_NO_FRAMES 1	//number of frames for "oh no!" losing animation
+#define MAX_END_FRAMES_BETWEEN_LEVELS 350	//number of frames between levels
+#define MAX_END_FRAMES_WIN_GAME 750	//number of frames at ending animation
+#define MAX_END_FRAMES_GAMEOVER 400	//number of frames at game over
+#define END_FRAME_DY 2	//rise speed of ending animation text
+#define WIN_GAME_XAMP 4	//the xamplitide of winning game text circular motion
+#define WIN_GAME_YAMP 4	//the yamplitude of winning game text circular motion
+#define WIN_GAME_ANGLE_MULT 4	//the angle multiplier for winning game text circ motion
+
+//tux frame lengths (number of frames each cell of animation frames on-screen)
+#define WALK_ONSCREEN	10
+#define RUN_ONSCREEN	8
+#define STAND_ONSCREEN	15
+#define GULP_ONSCREEN	10
+//tux default walking & running speeds
+#define WALKING_SPEED	1.5
+//#define WALKING_SPEED         1
+#define MIN_RUNNING_SPEED		4 * WALKING_SPEED
+#define MAX_RUNNING_SPEED		10 * WALKING_SPEED
+/*-- These last two are for future features --*/
+#define WIN_ONSCREEN		1
+#define YIPE_ONSCREEN		2
+
+//fishy defs
+#define MAX_FISHIES_EASY	15
+#define MAX_FISHIES_MEDIUM	30
+#define MAX_FISHIES_HARD	40
+#define MAX_FISHIES_DIGITS	2
+
+#define FISHY_ONSCREEN	10
+#define SPLAT_FRAMES	1
+#define SPLAT_ONSCREEN	4
+#define DEFAULT_SPEED	.3
+
+#define MAX_SPEED_EASY       0.4
+#define MAX_SPEED_MEDIUM     0.9
+#define MAX_SPEED_HARD       1.2
+
+#define FISH_SPACING_EASY    90
+#define FISH_SPACING_MEDIUM  40
+#define FISH_SPACING_HARD    30
+
+#define LIVES_INIT_EASY      5
+#define LIVES_INIT_MEDIUM    7
+#define LIVES_INIT_HARD      9
+
+#define MAX_UPDATES	3*(20+MAX_FISHIES_HARD)	//20 to account for text updates (I hope)
+
+/* The default alpha for slow moving words,
+ note that 128 is optimized for speed! */
+#define DEFAULT_ALPHA 128
+
+typedef struct {
+    int frames;			//number of frames to display this object
+    SDL_Surface *image;
+} object;			//normal (non-RL) object
+
+struct fishypoo {
+    int alive;
+    int can_eat;
+    wchar_t* word;
+    double x, y;
+    int    w;
+    size_t len;
+    int    splat_time;
+    double dy;
+} fish_object[MAX_FISHIES_HARD + 1];
+
+struct fishypoo null_fishy;
+
+enum {
+	TUX_WALKING,
+	TUX_STANDING,
+	TUX_RUNNING,
+	TUX_GULPING,
+	TUX_WINNING,
+	TUX_YIPING,
+	TUX_NUM_STATES
+};
+
+static unsigned char* tux_sprite_fns[TUX_NUM_STATES] = {
+	"tux/walk",
+	"tux/stand",
+	"tux/run",
+	"tux/gulp",
+	"tux/win",
+	"tux/yipe"
+};
+
+#define RIGHT 0
+#define LEFT 1
+
+struct tuxguy {
+    int facing;
+    double x, y;
+    double dx, dy;
+    sprite *spr[TUX_NUM_STATES][2];
+    int endx, endy;
+    int state;
+    int wordlen;
+    wchar_t word[MAX_WORD_SIZE + 1];
+} tux_object;
+
+struct splatter {
+    double x, y;
+    int alive;
+} splat_object[MAX_FISHIES_HARD + 1];
+
+struct splatter null_splat;
+
+
+
+
+#endif

Added: tuxtype/branches/tuxtype-reorg/src/practice.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/practice.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/practice.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,583 @@
+/**************************************************************************
+practice.c 
+-  description: practice module
+-------------------
+begin                : Friday Jan 25, 2003
+copyright            : (C) 2003 by Jesse Andrews
+email                : jdandr2 at uky.edu
+
+Revised extensively: 2007
+David Bruce <dbruce at tampabay.rr.com>
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+static SDL_Surface* bg = NULL;
+static SDL_Surface* hands = NULL; 
+static SDL_Surface* hand[11] = {NULL};
+static SDL_Rect hand_loc, letter_loc;
+static TTF_Font* font = NULL;
+static wchar_t phrase[255][FNLEN];
+
+static Mix_Chunk* wrong = NULL;
+
+/*local function prototypes: */
+static int get_phrase(const wchar_t* phr);
+static int practice_load_media(void);
+static void practice_unload_media(void);
+static void print_at(const wchar_t* pphrase, int wrap, int x, int y);
+static void show(unsigned char t);
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Public" functions (callable throughout program)             */
+/*                                                                      */
+/************************************************************************/
+
+
+/* FIXME this is not UTF-8/Unicode compatible */
+int Phrases(wchar_t* pphrase )
+{
+
+  /* TODO 
+  * 
+  * 
+  * 
+  */
+
+  /* FIXME make variable names more descriptive */
+  Uint32 start = 0, a = 0;
+  int quit = 0,
+      i = 0,
+      c = 0,
+      wp = 0,
+      z = 0,
+      total = 0,
+      state = 0;
+  int key[100] = {0};
+  SDL_Rect dst, dst2, dst3, dst4, dst5;
+  char keytime[20],
+       totaltime[20];
+  SDL_Surface* srfc = NULL;
+
+
+  
+  if (!practice_load_media())
+  {
+    fprintf(stderr, "Phrases() - practice_load_media() failed, returning.\n");
+    return 0;
+  }
+
+  SDL_BlitSurface(bg, NULL, screen, NULL);
+  SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+  SDL_Flip(screen);
+
+  wp = get_phrase(pphrase);
+
+  if (!wcsncmp(phrase[0], (wchar_t*)"", 1))
+    wcsncpy(pphrase, phrase[0], 80);
+
+  srfc = GetWhiteGlyph(65);
+
+  if (!srfc)
+  {
+    fprintf(stderr, "Phrases() - GetWhiteGlyph(65) not defined - bailing out.\n");
+    return 0;
+  }
+
+  dst.x = 320 - (srfc->w/2);
+  dst.y = 100;
+  dst.w = srfc->w;
+  dst.h = srfc->h;
+
+  dst2.x = 50;
+  dst2.y = 400;
+  dst2.w = srfc->w;
+  dst2.h = srfc->h;
+
+  dst3.x = 50;
+  dst3.y = 400;
+  dst3.w = 160;
+  dst3.h = 50;
+
+  dst4.x = 480;
+  dst4.y = 400;
+  dst4.w = 240;
+  dst4.h = 50;
+
+  dst5.x = 480;
+  dst5.y = 400;
+  dst5.w = 240;
+  dst5.h = 50;
+
+  dst.x = 40;
+
+  start = SDL_GetTicks();
+
+  do
+  {
+    switch (state)
+    {
+      case 0:
+        start = SDL_GetTicks();
+        SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+        state = 1;
+        break;
+
+      case 1:
+        if (SDL_GetTicks() - start > 500)
+        {
+          /* Show finger hint, if available. Note that GetFinger() */
+          /* returns negative values on error and never returns a  */
+          /* value greater than 9.                                 */
+          int fing = GetFinger(pphrase[c]);
+          if (fing >= 0) 
+            SDL_BlitSurface(hand[fing], NULL, screen, &hand_loc);
+          state = 2;
+        }
+        break;
+
+      case 2:
+        if (state == 2 && SDL_GetTicks() - start > 750)
+        {
+          state = 3;
+        }
+        break;
+
+      case 3:
+       SDL_BlitSurface(hands, NULL, screen, &hand_loc);
+       state = 12;
+       break;  
+
+      case 4:
+        {
+          int fing = GetFinger(pphrase[c]);
+          if (fing >= 0) 
+            SDL_BlitSurface(hand[fing], NULL, screen, &hand_loc);
+          state = 11;
+          break;
+        }
+
+      default:
+        state -= 2; // this is to make the flashing slower
+    }
+
+
+    while  (SDL_PollEvent(&event))
+    {
+      if (event.type == SDL_KEYDOWN)
+      {
+        a = SDL_GetTicks();
+        key[c] = a - start;
+        total += key[c];
+        sprintf(keytime, "%.2f", (float) key[c] / 1000);
+        sprintf(totaltime, "%.2f", (float) total / 1000);
+        start = a;
+
+        if (event.key.keysym.sym == SDLK_ESCAPE)
+          quit = 1;
+
+        if (event.key.keysym.sym == SDLK_DOWN) 
+        {
+          //practice next phase in list
+          //a=a;
+        }
+        else
+        {
+          if (pphrase[c]==(char)event.key.keysym.unicode)
+          {
+            state = 0;
+            dst2.x = 40;
+            dst4.x = 480;
+            SDL_BlitSurface(bg, &dst3, screen, &dst2);
+            SDL_BlitSurface(bg, &dst5, screen, &dst4);
+            SDL_Flip(screen);
+
+            srfc = GetWhiteGlyph(event.key.keysym.unicode);
+            if (srfc)
+            { 
+              SDL_BlitSurface(srfc, NULL, screen, &dst);
+              dst.x = (dst.x + srfc->w) - 5;
+            }
+ 
+            for (z = 0; z < strlen(keytime); z++)
+            {
+              srfc = GetWhiteGlyph((int)keytime[z]);
+              if (srfc)
+              {
+                SDL_BlitSurface(srfc, NULL, screen, &dst2);
+                dst2.x = dst2.x + srfc->w - 2;
+              }
+            }
+
+            for (z = 0;z < strlen(totaltime); z++)
+            {
+              srfc = GetWhiteGlyph((int)totaltime[z]);
+              if (srfc)
+              {
+                SDL_BlitSurface(srfc, NULL, screen, &dst4);
+                dst4.x = dst4.x + srfc->w - 2;
+              }
+            }
+
+
+            if (c == (wcslen(pphrase) - 1))
+            {
+              wchar_t buf[10];
+              ConvertFromUTF8(buf, _("Great!"));
+              print_at(buf,6 ,275 ,200);
+              SDL_Flip(screen);
+              SDL_Delay(2500);
+              quit = 1;
+            }
+
+            if (c == wp)
+            {
+              c++;
+              dst.x = 40;
+              dst.y = 142;
+            }
+
+            c++;
+          }
+          else
+          {
+            if (event.key.keysym.sym != SDLK_RSHIFT
+             && event.key.keysym.sym != SDLK_LSHIFT)
+             PlaySound(wrong);
+          }
+        }
+      }
+    }
+    SDL_Flip(screen);
+    SDL_Delay(30);
+
+  }while (!quit);
+
+  practice_unload_media();
+
+  return 1;
+}
+
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*       "Private" functions (local to practice.c)                      */
+/*                                                                      */
+/************************************************************************/
+
+
+static int practice_load_media(void)
+{
+  int i;	
+  unsigned char fn[FNLEN];
+  unsigned char let[5];
+  int load_failed = 0;
+
+  LOG("Loading practice media\n");
+
+
+  hands = LoadImage("hands/hands.png", IMG_ALPHA);
+  bg = LoadImage("main_bkg.png", IMG_ALPHA);
+  wrong = LoadSound("tock.wav");
+  font = LoadFont(settings.theme_font_name, 30);
+
+  for (i = 0; i < 10; i++)
+  {
+    sprintf(fn, "hands/%d.png", i);
+    hand[i] = LoadImage(fn, IMG_ALPHA);
+    if (!hand[i])
+      load_failed = 1;
+  }
+
+  /* Get out if anything failed to load: */
+  if (load_failed
+    ||!hands
+    ||!bg
+    ||!wrong
+    ||!font)
+  {
+    fprintf(stderr, "practice_load_media() - failed to load needed media \n");
+    practice_unload_media;
+    return 0;
+  }
+
+  /* Should be safe from here on out: */
+  hand_loc.x = (screen->w/2) - (hand[0]->w/2);
+  hand_loc.y = screen->h - (hand[0]->h);
+  hand_loc.w = (hand[0]->w);
+  hand_loc.h = (hand[0]->h);
+
+  /* Now render letters for glyphs in alphabet: */
+  RenderLetters(font);
+  TTF_CloseFont(font);  /* Don't need it after rendering done */
+  font = NULL;
+
+  LOG("DONE - Loading practice media\n");
+  return 1;
+}
+
+
+
+static void practice_unload_media(void)
+{
+	int i;
+	SDL_FreeSurface(bg);
+        bg = NULL;
+	SDL_FreeSurface(hands);
+        hands = NULL;
+	//TTF_CloseFont(font);
+
+	for (i=0; i<10; i++) 
+        {
+          SDL_FreeSurface(hand[i]);
+          hand[i] = NULL;
+        }
+
+	Mix_FreeChunk(wrong);
+	wrong = NULL;
+}
+
+
+/* looks like dead code: */
+static void show(unsigned char t)
+{
+	SDL_Rect dst;
+        SDL_Surface* s = NULL;
+
+        s= GetWhiteGlyph((int)t);
+        if (!s)
+          return; 
+	dst.x = 320 - (s->w/2);
+	dst.y = 100;
+	dst.w = s->w;
+	dst.h = s->h;
+	SDL_BlitSurface(s, NULL, screen, &dst);
+}
+
+
+
+static int get_phrase(const wchar_t* phr)
+{
+  int pc = 0;  // 'phrase count' (?)
+  int pw[256] = { 0 };
+  int wp = 0, i = 0, c = 0, z = 0;
+  char fn[FNLEN];
+
+  /* If we didn't receive a phrase get the first one from the file...*/
+  if (wcsncmp((wchar_t*)"", phr, 40) == 0)
+  {
+    FILE* pf; /*   "phrase file"   */
+    /* set the phrases directory/file */
+    /* FIXME I think the phrases should be under data or the theme */
+#ifdef WIN32
+    snprintf(fn, FNLEN - 1, "userdata/phrases.txt");
+#else
+    snprintf(fn, FNLEN - 1, (const char*)"%s/.tuxtype/phrases.txt", getenv("HOME"));
+#endif
+
+    DEBUGCODE { printf("get_phrases(): phrases file is '%s'\n", fn ); }
+    LOG("get_phrases(): trying to open phrases file\n");
+    pf = fopen( fn, "r" );
+    if (pf == NULL) 
+      return(wp);  /* why not just 'return 0;' ??? */
+
+    /* So now copy each line into phrases array: */
+    while (!feof(pf) && pc < 256) 
+    {
+      fscanf( pf, "%[^\n]\n", phrase[pc] );
+      pc++;
+      DEBUGCODE {printf("%s", phrase[pc]);}
+    }
+    if (pc == 256)
+      LOG("File contains more than max allowed phrases - stopping\n");
+
+    fclose(pf);
+    pc--;
+  } 
+  else
+  {
+    pc = 1;
+    wcsncpy(phrase[0], phr, 80);
+  }
+
+  /* FIXME maybe should verify that all chars in phrase are 
+//   /* Need to generate glyphs for all the needed Unicode chars: */
+// 
+//   ResetCharList();
+//   /* 'A' (i.e. 65) always has to go into list because width used for layout */
+//   /* HACK also need chars for "Great!" because of congrats message - this   */
+//   /* obviously is not a general solution. Numerals also needed for timers.  */
+//   {
+//     char* let = "AGreat!0123456789.";
+//     GenCharListFromString(let);
+//   }
+// 
+// 
+//   /* Scan through all the phrases and put needed chars into list: */
+//   for (c = 0; c <= pc; c++)
+//     GenCharListFromString(phrase[c]);
+// 
+//   /* Now render letters for glyphs in list: */
+//   font = LoadFont(settings.theme_font_name, 32 );
+//   if (!font)
+//   {
+//     fprintf(stderr, "get_phrase() - could not load font\n");
+//     return 0;
+//   }
+// 
+//   RenderLetters(font);
+// 
+//   TTF_CloseFont(font);
+//   font = NULL;
+
+
+  //Calculate and record pixel width of phrases
+  {
+    SDL_Surface* let = NULL;
+    for (c = 0; c <= pc; c++)
+    {
+      for(i = 0; i < wcslen(phrase[c]); i++)
+      {
+        let = GetWhiteGlyph((int)phrase[c][i]);
+        if (let)  
+          pw[c]+= let->w - 5;
+        else
+        {
+          fprintf(stderr, "get_phrase() - needed glyph not available\n");
+          return;
+        }
+      }
+    }
+  }
+
+  //Find wrapping point
+  for (c = 0; c <= pc; c++)
+  {
+    if (pw[c] < 598)  // If the phrase is less than 598 pixels wide
+    {
+      if (c == 0)
+      {
+        wp = wcslen(phrase[c]);
+        print_at(phrase[0], wp, 40, 10);
+      }
+    }
+    else
+    {
+      z = 0;
+      wp = 0;
+
+      for (i = 0; i < wcslen(phrase[c]); i++)
+      {
+        /* Should be safe (if no glyph, will have returned above) */
+        z += GetWhiteGlyph((int)phrase[c][i])->w-5;
+        if (wp == 0 && z > 598)
+        {
+          wp = i - 1;
+          break;
+        }
+      }
+
+      for (i = wp; i >= 0; i--)
+      {
+        if (wcsncmp((wchar_t*)" ", &phrase[c][i], 1) == 0)
+        {
+          wp = i-1;
+          break;
+        }
+      }
+
+      if (c == 0)
+      {
+        print_at(phrase[0], wp, 40, 10);
+      }
+    }
+  }
+  LOG("Leaving get_phrase()\n");
+  return(wp);
+}
+
+
+
+static void print_at(const wchar_t *pphrase, int wrap, int x, int y)
+{
+  int z = 0;
+  SDL_Surface* surf = NULL;
+  letter_loc.x = x;
+  letter_loc.y = y;
+  letter_loc.w = GetWhiteGlyph(65)->w;
+  letter_loc.h = GetWhiteGlyph(65)->h;
+
+  LOG("Entering print_at()\n");
+
+  if (wrap >= wcslen(pphrase)) // I think this means it fits on a single line
+  {
+    for (z = 0; z <wcslen(pphrase); z++)
+    {
+      surf = GetWhiteGlyph(pphrase[z]);
+      if (surf)
+      {
+        DEBUGCODE{printf("surf not NULL for %C\n", pphrase[z]);}
+        SDL_BlitSurface(surf, NULL, screen, &letter_loc);
+        letter_loc.x = (letter_loc.x + surf->w) - 5;
+      }
+      else
+      {
+        fprintf(stderr, "print_at(): needed glyph for %C not found\n",
+                pphrase[z]);
+      }
+    }
+  }
+  else  /* Another line required - code only seems to support 1 or 2 lines! */
+  {
+    for (z = 0; z <= wrap; z++) 
+    {
+      surf = GetWhiteGlyph(pphrase[z]);
+      if (surf)
+      {
+        DEBUGCODE{printf("surf not NULL for %C\n", pphrase[z]);}
+        SDL_BlitSurface(surf, NULL, screen, &letter_loc);
+        letter_loc.x = (letter_loc.x + surf->w) - 5;      }
+      else
+      {
+        fprintf(stderr, "print_at(): needed glyph for %C not found\n",
+                pphrase[z]);
+      }
+    }
+
+    /* Move 'cursor' back to left and down one line: */
+    letter_loc.x = 40;
+    // - (letter_loc.h/4) to account for free space at top and bottom of rendered letters
+    letter_loc.y = letter_loc.y + letter_loc.h - (letter_loc.h/4);
+
+    for (z = wrap + 2; z <wcslen(pphrase); z++)
+    {
+      surf = GetWhiteGlyph(pphrase[z]);
+      if (surf)
+      {
+        DEBUGCODE{printf("surf not NULL for %c\n", pphrase[z]);}
+        SDL_BlitSurface(surf, NULL, screen, &letter_loc);
+        letter_loc.x = (letter_loc.x + surf->w) - 5;
+      }
+      else
+      {
+        fprintf(stderr, "print_at(): needed glyph for %c not found",
+                pphrase[z]);
+      }
+    }
+  }
+  LOG("Leaving print_at()\n");
+}
+

Added: tuxtype/branches/tuxtype-reorg/src/scripting.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/scripting.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/scripting.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,1364 @@
+/***************************************************************************
+ -  file: scripting.c
+ -  description: scripting for lessons & instructions ...
+                             -------------------
+    begin                : Sun Dec 28, 2003
+    copyright            : Jesse Andrews (C) 2003
+    email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "scripting.h"
+
+/* Local function prototypes: */
+static void clear_items(itemType* i);
+static void clear_pages(pageType* p);
+static void close_script(void);
+static SDL_Color* get_color(const char* in);
+static int get_int(const char* in);
+static char* get_quote(const char* in);
+static char hex2int(char b, char s);
+static int load_script(const char* fn);
+static void run_script(void);
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Public" functions (callable throughout program)             */
+/*                                                                      */
+/************************************************************************/
+
+
+void InstructCascade(void)
+{
+  char fn[FNLEN]; 
+
+  /* Try theme script first: */
+  if (!settings.use_english)
+    sprintf( fn, "%s/scripts/cascade.xml", settings.theme_data_path);
+
+  if (load_script( fn ) == 0) /* meaning successful load */
+  {
+    run_script();
+    return;
+  }
+
+  /* If unsuccessful, fall back to default (English) script: */
+  sprintf( fn, "%s/scripts/cascade.xml", settings.default_data_path);
+  if (load_script( fn ) != 0)
+    return; // bail if any errors occur
+
+  run_script();
+}
+
+
+void InstructLaser(void)
+{
+  char fn[FNLEN]; 
+  int i;
+
+  /* Try theme script first: */
+  if (!settings.use_english)
+    sprintf( fn, "%s/scripts/laser.xml", settings.theme_data_path);
+
+  if (load_script( fn ) == 0) /* meaning successful load */
+  {
+    for (i = 0; i < 20; i++)
+    {
+      run_script();
+      SDL_Delay(500);
+    }
+    return;
+  }
+
+
+  /* If unsuccessful, fall back to default (English) script: */
+  sprintf( fn, "%s/scripts/laser.xml", settings.default_data_path);
+  if (load_script( fn ) != 0)
+    return; // bail if any errors occur
+
+  for (i = 0; i < 20; i++)
+  {
+    run_script();
+    SDL_Delay(500);
+  }
+}
+
+
+void ProjectInfo(void)
+{
+  char fn[FNLEN]; 
+
+  /* Try theme script first: */
+  if (!settings.use_english)
+    sprintf( fn, "%s/scripts/projectInfo.xml", settings.theme_data_path);
+
+  if (load_script( fn ) == 0) /* meaning successful load */
+  {
+    run_script();
+    return;
+  }
+
+  /* If unsuccessful, fall back to default (English) script: */
+  sprintf( fn, "%s/scripts/projectInfo.xml", settings.default_data_path);
+  if (load_script( fn ) != 0)
+    return; // bail if any errors occur
+
+  run_script();
+}
+
+
+int TestLesson(void)
+{
+  SDL_Surface* left = NULL, *right = NULL, *pointer = NULL, *bkg = NULL;
+  SDL_Surface* filenames[200] = {NULL};
+
+  SDL_Rect spot, arrow_area;
+  SDL_Rect leftRect, rightRect;
+  SDL_Rect titleRects[8];
+
+  TTF_Font* font = NULL;
+	
+  int stop = 0;
+  int loc = 0;
+  int old_loc = 1;
+  int i;
+  int c = 0;
+  int found = 0;
+	
+  char fn[FNLEN]; 
+  unsigned char wordlistFile[200][200];
+  unsigned char script_path[FNLEN];
+
+  DIR* wordsDir = NULL;
+  struct dirent* wordsFile = NULL;
+
+  LOG("\nEnter TestLesson()\n");
+
+  pointer = LoadImage( "right.png", IMG_ALPHA );
+  bkg = LoadImage( "main_bkg.png", IMG_REGULAR );
+  left = LoadImage("left.png", IMG_ALPHA);       
+  right = LoadImage("right.png", IMG_ALPHA);
+
+  if (!pointer || !bkg || !left ||!right)
+  {
+    fprintf(stderr, "TestLesson() - needed image not found\n");
+    /* Free anything that got loaded: */
+    SDL_FreeSurface(pointer);
+    SDL_FreeSurface(left);
+    SDL_FreeSurface(right);
+    SDL_FreeSurface(bkg);
+    pointer = left = right = bkg = NULL;
+    return 0;
+  }
+
+  SDL_ShowCursor(0);
+
+  /* find the directory to load wordlists from */
+  /* First look in theme path, if desired: */
+  if (!settings.use_english)
+  {
+    sprintf( script_path, "%s/scripts", settings.theme_data_path);
+    if (CheckFile(script_path))
+    {
+      DEBUGCODE { fprintf(stderr, "Using theme script dir: %s\n", script_path); }
+      found = 1;
+    }
+  }
+
+  /* Now look in default path if desired or needed: */
+  if (!found)
+  {
+    sprintf( script_path, "%s/scripts", settings.default_data_path);
+    if (CheckFile(script_path))
+    {
+      DEBUGCODE { fprintf(stderr, "Using theme script dir: %s\n", script_path); }
+      found = 1;
+    }
+  }
+
+  if (!found)
+  {
+    fprintf(stderr, "TestLesson(): Error finding script directory!\n");
+    return 0;
+  }
+
+  /* What is this location? */
+  spot.x = 60;
+  spot.y = 20;
+
+
+  /* create a list of all the .xml files */
+
+  wordsDir = opendir( script_path );	
+  font = LoadFont(settings.theme_font_name, MENU_FONT_SIZE);
+  do
+  {
+    wordsFile = readdir(wordsDir);
+    if (!wordsFile)
+      break;
+
+    /* must have at least '.xml' at the end */
+    if (strlen(wordsFile->d_name) < 5)
+      continue;
+
+    if (strcmp(&wordsFile->d_name[strlen(wordsFile->d_name)-4],".xml"))
+      continue;
+
+    sprintf( wordlistFile[c], "%s", wordsFile->d_name );
+
+    DEBUGCODE { fprintf(stderr, "Adding XML file no. %d: %s\n", c, wordlistFile[c]); }
+
+
+    filenames[c] = TTF_RenderUTF8_Blended(font, wordsFile->d_name, white);
+    SDL_BlitSurface( filenames[c], NULL, screen, &spot );
+    SDL_FreeSurface(filenames[c]);
+    c++;
+    spot.y += MENU_FONT_SIZE;
+  } while (1); /* Leave loop when readdir() returns NULL */
+
+  TTF_CloseFont(font);
+  font = NULL;
+  closedir(wordsDir);	
+  wordsDir = NULL;
+  SDL_Flip(screen);
+
+  /* Should be safe - tested 'left' and 'right' above: */
+  leftRect.w = left->w; leftRect.h = left->h;
+  leftRect.x = 320 - 80 - (leftRect.w/2); leftRect.y = 430;
+
+  rightRect.w = right->w; rightRect.h = right->h;
+  rightRect.x = 320 + 80 - (rightRect.w/2); rightRect.y = 430;
+
+  /* set initial rect sizes */
+  titleRects[0].y = 30;
+  titleRects[0].w = titleRects[0].h = titleRects[0].x = 0;
+
+  for (i = 1; i < 8; i++)
+  { 
+    titleRects[i].y = titleRects[i-1].y + 50;
+    titleRects[i].w = titleRects[i].h = titleRects[i].x = 0;
+  }
+
+  arrow_area.x = 0;
+  arrow_area.y = 0;
+  arrow_area.w = 59;
+  arrow_area.h = 479;
+
+  while (!stop)
+  {
+    while (SDL_PollEvent(&event))
+    {
+      switch (event.type)
+      {
+        case SDL_QUIT:
+          exit(0);
+          break;
+        /* FIXME some of mouse code is wrong */
+        case SDL_MOUSEMOTION:
+          for (i=0; (i<8) && (loc-(loc%8)+i<c); i++)
+            if (inRect( titleRects[i], event.motion.x, event.motion.y ))
+            {
+              loc = loc-(loc%8)+i;
+              break;
+            }
+          break;
+
+        case SDL_MOUSEBUTTONDOWN:
+          if (inRect( leftRect, event.button.x, event.button.y ))
+            if (loc-(loc%8)-8 >= 0)
+            {
+              loc=loc-(loc%8)-8;
+              break;
+            }
+
+          if (inRect( rightRect, event.button.x, event.button.y ))
+            if (loc-(loc%8)+8 < c)
+            {
+              loc=loc-(loc%8)+8;
+              break;
+            }
+
+          for (i=0; (i<8) && (loc-(loc%8)+i<c); i++)
+            if (inRect(titleRects[i], event.button.x, event.button.y))
+            {
+//              loc = loc-(loc%8)+i;
+//              ClearWordList(); /* clear old selection */
+//               if (loc==0)
+//                 UseAlphabet(); 
+//               else
+//                 GenerateWordList(wordlistFile[loc]);
+// 
+//               stop = 1;
+//               break;
+            }
+          break;
+
+        case SDL_KEYDOWN:
+          if (event.key.keysym.sym == SDLK_ESCAPE)
+          { 
+            stop = 2;
+            break;
+          }
+
+          if (event.key.keysym.sym == SDLK_RETURN)
+          {
+            sprintf(fn, "%s/scripts/%s", settings.default_data_path, wordlistFile[loc]);
+            stop = 1;
+            break;
+          }
+
+          if ((event.key.keysym.sym == SDLK_LEFT) || (event.key.keysym.sym == SDLK_PAGEUP))
+          {
+            if (loc-(loc%8)-8 >= 0)
+              loc=loc-(loc%8)-8;
+            SDL_ShowCursor(1);
+          }
+
+          if ((event.key.keysym.sym == SDLK_RIGHT) || (event.key.keysym.sym == SDLK_PAGEDOWN))
+          {
+            if (loc-(loc%8)+8 < c)
+              loc=(loc-(loc%8)+8);
+          }
+
+          if (event.key.keysym.sym == SDLK_UP)
+          {
+            if (loc > 0)
+              loc--;
+          }
+
+          if (event.key.keysym.sym == SDLK_DOWN)
+          {
+            if (loc+1< c)
+              loc++;
+          }
+      } /* End of 'switch(event.type)' loop */
+    }  /* End of 'while(SDL_PollEvent(&event))' loop */
+
+
+
+    if (old_loc != loc)
+    {
+      int start;
+      SDL_BlitSurface( bkg, &arrow_area, screen, NULL);
+
+      start = loc;
+      for (i = start; i < c; i++)
+      {
+        spot.x = 5;
+        spot.y = (i * MENU_FONT_SIZE) + 18;
+        if (i == loc)
+          SDL_BlitSurface(pointer, NULL, screen, &spot);
+      }
+
+      SDL_Flip(screen);
+    }
+
+      SDL_Delay(40);
+      old_loc = loc;
+  }   /*   End of 'while(!stop)' loop  */
+
+  SDL_FreeSurface(pointer);
+  SDL_FreeSurface(left);
+  SDL_FreeSurface(right);
+  SDL_FreeSurface(bkg);
+  pointer = left = right = bkg = NULL;
+
+  if (stop == 2)
+  {
+    LOG("Player pressed 'Esc' - leaving TestLesson\n");
+    return 1;
+  }
+
+  /* Getting to here means "stop == 1", try to run chosen script: */
+  if (load_script(fn) != 0)
+  {
+    fprintf(stderr, "load_script() failed to load '%s'\n");
+    return 0; // bail if any errors occur
+  }
+
+  DEBUGCODE { fprintf(stderr, "Attempting to run script: %s\n", fn); }
+
+  run_script();
+
+  /* FIXME - shouldn't we show the cursor if returning in other code paths? */
+  SDL_ShowCursor(1);
+
+  LOG("Leave TestLesson()\n");
+
+  return 1; 
+}
+
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Private" functions (local to scripting.c)                   */
+/*                                                                      */
+/************************************************************************/
+
+
+static char* get_quote(const char* in)
+{
+    int start, finish;
+    char *out;
+
+    for (start=0; start<strlen(in) && in[start] != '"'; start++);  // find the first "
+
+    if (start >= strlen(in)) return 0; // return null string if no " found
+
+    start++; // move past the "
+    
+    for (finish=start; finish<strlen(in) && in[finish] != '"'; finish++); // find the next "
+
+    if (finish >= strlen(in)) return 0; // return null string if no " found
+    
+    out = malloc(finish-start+2);
+    
+    snprintf(out, finish-start+1, &in[start]);
+    out[finish-start]=0;
+    
+    return out;
+}
+
+
+static int get_int(const char* in)
+{
+    char *t = get_quote(in);
+    int ans=-1;
+    if (t) {
+        ans = atoi(t);
+        free(t);
+    }
+    return ans;
+}
+
+
+static char hex2int(char b, char s)
+{
+    char ans=0;
+        
+    if      ((b>='0') && (b<='9'))       ans=16*(b-'0');
+    else if ((b>='A') && (b<='F'))       ans=16*(b-'A'+10);
+    else if ((b>='a') && (b<='f'))       ans=16*(b-'a'+10);
+    
+    if      ((s>='0') && (s<='9'))       ans+=(s-'0');
+    else if ((s>='A') && (s<='F'))       ans+=(s-'A'+10);
+    else if ((s>='a') && (s<='f'))       ans+=(s-'a'+10);
+
+    return ans;
+}
+
+
+static SDL_Color* get_color(const char* in)
+{
+    char* col;
+    SDL_Color* out=malloc(sizeof(SDL_Color));
+    col = get_quote(in);
+    
+    if ((strlen(col)==7) && (col[0] == '#')) {
+        out->r = hex2int( col[1], col[2] );
+        out->g = hex2int( col[3], col[4] );
+        out->b = hex2int( col[5], col[6] );
+    }
+    
+    free(col);
+    
+    return out;
+}
+
+scriptType* curScript = NULL;
+pageType* curPage = NULL;
+itemType* curItem = NULL;
+
+static int load_script(const char* fn)
+{
+  int i;
+  char str[FNLEN];
+  FILE* f = NULL;
+    
+  DEBUGCODE
+  {
+    fprintf(stderr, "\nEnter load_script() - attempt to load '%s'\n", fn);
+  }
+
+  if (curScript)
+  {
+    LOG( "previous script in memory, removing now!\n");
+    close_script();
+  }
+    
+
+  f = fopen(fn, "r");
+
+  if (f == NULL)
+  {
+    fprintf(stderr, "error loading script %s\n", fn);
+    return -1;
+  }
+
+  do
+  {
+    fscanf(f, "%[^\n]\n", str);
+    if (strncmp("<script", str, 7) == 0)
+    {
+      /* -- allocate space for the lesson info -- */
+      curScript = (scriptType*)calloc(1, sizeof(scriptType));
+      for (i = 7; i < strlen(str) && str[i] != '>'; i++) 
+      {
+        if ((str[i] == 't') && strncmp("title", &str[i], 5) == 0)
+          curScript->title = get_quote(&str[i + 5]);
+
+        if ((str[i]=='b') && strncmp("bgcolor", &str[i], 7) == 0)
+          curScript->bgcolor = get_color(&str[i + 7]);
+
+        if ((str[i]=='b') && strncmp("background", &str[i], 10) == 0)
+          curScript->background = get_quote(&str[i + 10]);
+
+        if ((str[i]=='f') && strncmp("fgcolor", &str[i], 7) == 0) 
+          curScript->fgcolor = get_color(&str[i + 7]); 
+      }
+    }
+    else if (strncmp("<page", str,  5)==0)
+    {
+      if (curScript==NULL)
+      {
+        fprintf(stderr, "CRITICAL XML ERROR: <page> should be in a <script> in file %s line (todo)", fn); exit(1);
+      }
+
+      if (curScript->pages==NULL)
+      {
+        curPage = (pageType *)calloc(1,sizeof(pageType));
+        curPage->prev = curPage;
+        curScript->pages = curPage; 
+      }
+      else
+      {
+        curPage->next = (pageType*)calloc(1, sizeof(pageType));
+        curPage->next->prev = curPage;
+        curPage = curPage->next;
+      }
+
+      for (i = 5; i < strlen(str) && str[i]!='>'; i++)
+      {
+        if ((str[i] == 'b') && strncmp("background", &str[i], 10) == 0) 
+          curPage->background = get_quote(&str[i + 10]);
+
+        if ((str[i]== 't') && strncmp("title", &str[i], 5) == 0) 
+          curPage->title = get_quote(&str[i + 5]);
+
+        if ((str[i] == 'b') && strncmp("bgcolor", &str[i], 7) == 0) 
+          curPage->bgcolor = get_color(&str[i + 7]);
+
+        if ((str[i] == 'f') && strncmp("fgcolor", &str[i], 7) == 0) 
+          curPage->fgcolor = get_color(&str[i + 7]);
+      }
+    }
+    else if (strncmp("<text", str,  5) == 0)
+    {
+      if (curPage == NULL)
+      {
+        fprintf(stderr, "CRITICAL XML ERROR: <text> should be in a <page> in file %s line (todo)", fn); exit(1);
+      }
+
+      if (curPage->items == NULL) 
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      }
+      else
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemTEXT;
+      curItem->x = curItem->y = -1;
+
+      for (i = 5; i<strlen(str) && str[i]!='>'; i++)
+      {
+        if ((str[i] == 's') && strncmp("size", &str[i], 4) == 0)
+          curItem->size = (char)get_int(&str[i + 4]);
+
+        if ((str[i] == 'a') && strncmp("align", &str[i], 5) == 0)
+        {
+          char* t = get_quote(&str[i+5]);
+
+          if (strlen(t)>=1)
+          {
+            if ((t[0] == 'l') || (t[0]=='L'))
+              curItem->align='l';	// left
+            if ((t[0] == 'c') || (t[0]=='C'))
+              curItem->align='c';	// center
+            if ((t[0] == 'r') || (t[0]=='R'))
+              curItem->align='r';	// right
+            if ((t[0] == 'm') || (t[0]=='M'))
+              curItem->align='c';	// let 'm'iddle work as "center"
+          }
+          free(t);
+        }
+
+        if ((str[i] == 'c') && strncmp("color", &str[i], 5) == 0)
+           curItem->color = get_color(&str[i + 5]);
+
+        if ((str[i]== 'x') && strncmp(" x=", &str[i - 1], 3) == 0)
+           curItem->x = get_int(&str[i + 2]);
+
+        if ((str[i] == 'y') && strncmp(" y=", &str[i - 1], 3) == 0)
+           curItem->y = get_int(&str[i + 2]);
+      }
+
+      /* --- grab the text between <text> and </text> --- */
+      {
+        int start, finish;
+
+        for (start = 5; start < strlen(str) - 5 && str[start] != '>'; start++);
+
+        start++; // advance passed the '>'
+
+        for (finish = strlen(str) - 6; finish > 5; finish--)
+           if (strncmp( "</text>", &str[finish], 7) == 0)
+             break;
+
+        finish--; // advance passed the '<'
+
+        if (start <= finish)
+        {
+          curItem->data = (char*)calloc(1, finish - start + 2);
+          strncpy(curItem->data, &str[start], finish - start + 1);
+        }
+        else
+        {
+          if (start == finish + 1)
+          {
+            curItem->data = (char*)calloc(1, 2);
+            curItem->data[0]=' ';
+          }
+        }
+      }
+
+    } 
+    else if (strncmp("<img", str, 4) == 0)
+    {
+      if (curPage == NULL)
+      {
+        fprintf(stderr,
+                "CRITICAL XML ERROR: <img> should be in a <page> in file %s line (todo)",
+               fn);
+        exit(1); //FIXME should call cleanup() or maybe just return without exiting
+      }
+
+      if (curPage->items == NULL)
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      }
+      else 
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemIMG;
+      curItem->x = curItem->y = -1;
+
+      for (i = 5; i < strlen(str); i++) 
+      {
+        if ((str[i] == 'o') && strncmp("onclickplay", &str[i], 11) == 0)
+          curItem->onclick = get_quote(&str[i + 3]);
+
+        if ((str[i] == 'x') && strncmp(" x=", &str[i - 1], 3) == 0)
+          curItem->x = get_int(&str[i + 2]);
+
+        if ((str[i] == 'y') && strncmp(" y=", &str[i - 1], 3) == 0)
+          curItem->y = get_int(&str[i + 2]);
+
+        if ((str[i] == 's') && strncmp("src", &str[i], 3) == 0)
+          curItem->data = get_quote(&str[i + 3]);
+
+        if ((str[i] == 'a') && strncmp("align", &str[i], 5) == 0)
+        {
+          char* t = get_quote(&str[i + 5]);
+
+          if (strlen(t) >= 1)
+          {
+            if ((t[0] == 'l') || (t[0] == 'L'))
+               curItem->align='l';	// left
+
+            if ((t[0] == 'c') || (t[0]=='C'))
+               curItem->align='c';	// center
+
+            if ((t[0] == 'r') || (t[0]=='R'))
+               curItem->align='r';	// right
+
+            if ((t[0] == 'm') || (t[0]=='M'))
+               curItem->align='c';	// let 'm'iddle work as "center"
+          }
+          free(t);
+        }
+      }
+    }
+    else if (strncmp("<wav", str, 4) == 0)
+    {
+      if (curPage == NULL)
+      { 
+        fprintf(stderr,
+                "CRITICAL XML ERROR: <wav> should be in a <page> in file %s line (todo)",
+                fn);
+        exit(1);  /* FIXME call Cleanup() to exit */
+      }
+
+      if (curPage->items == NULL)
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      } 
+      else 
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemWAV;
+      curItem->loop = 0;
+
+      for (i =5 ; i < strlen(str); i++)
+      {
+        if ((str[i] == 's') && strncmp("src", &str[i], 3) ==0 )
+          curItem->data = get_quote(&str[i + 3]);
+
+        if ((str[i] == 'l') && strncmp("loop", &str[i], 4) == 0)
+        {
+          char* t = get_quote(&str[i + 4]);
+
+          if (strlen(t) >= 1)
+          {
+            if ((t[0] == 't') || (t[0]=='T'))
+              curItem->loop = 1;
+          } 
+          free(t);
+        }
+      }
+    }
+    else if (strncmp("<prac", str, 5) == 0)
+    {
+      if (curPage == NULL)
+      {
+        fprintf(stderr,
+                "CRITICAL XML ERROR: <prac> should be in a <page> in file %s line (todo)",
+                fn);
+        exit(1); /* FIXME call cleanup() rather than exit() */
+      }
+
+      if (curPage->items == NULL)
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      }
+      else
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemPRAC;
+
+      for (i = 5; i < strlen(str) && str[i] != '>'; i++)
+      {
+        if ((str[i] == 's') && strncmp("size", &str[i], 4) == 0) 
+          curItem->size = (char)get_int( &str[i + 4]);
+
+        if ((str[i] == 'g') && strncmp("goal", &str[i], 4) == 0) 
+          curItem->goal = (char)get_int(&str[i + 4]);
+
+        if ((str[i] == 'a') && strncmp("align", &str[i], 5) == 0)
+        {
+          char* t = get_quote(&str[i + 5]);
+
+          if (strlen(t) >= 1)
+          {
+            if ((t[0] == 'l') || (t[0]=='L'))
+              curItem->align = 'l';	// left
+            if ((t[0] == 'c') || (t[0]=='C'))
+              curItem->align = 'c';	// center
+            if ((t[0] == 'r') || (t[0]=='R'))
+              curItem->align = 'r';	// right
+            if ((t[0] == 'm') || (t[0]=='M'))
+              curItem->align = 'c';	// let 'm'iddle work as "center"
+          }
+                   free(t);
+        }
+
+        if ((str[i] == 'c') && strncmp("color", &str[i], 5) == 0)
+          curItem->color = get_color(&str[i + 5]);
+      }
+
+      { /* --- grab the text between <prac> and </prac> --- */
+        int start, finish;
+
+        for (start = 5; start < strlen(str) - 5 && str[start] != '>'; start++);
+
+        start++; // advance passed the '>/* --- grab the text between <prac> and </prac> --- */'
+
+        for (finish = strlen(str) - 6; finish > 5; finish--)
+          if (strncmp("</prac>", &str[finish], 7) == 0)
+            break;
+
+        finish--; // advance passed the '<'
+
+        if (start <= finish)
+        {
+          curItem->data = (char*)calloc(1, finish - start + 2);
+          strncpy(curItem->data, &str[start], finish - start + 1);
+        }
+        else
+        {
+          if (start == finish + 1)
+          {
+            curItem->data = (char*)calloc(1, 2);
+            curItem->data[0]=' ';
+          }
+        }
+      }
+    }
+    else if (strncmp("<waitforinput", str, 13) == 0)
+    { 
+      if (curPage == NULL)
+      {
+        fprintf(stderr,
+               "CRITICAL XML ERROR: <waitforinput> should be in a <page> in file %s line (todo)",
+                fn);
+        exit(1);
+      }
+
+      if (curPage->items == NULL)
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      } 
+      else
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemWFIN;
+
+    }
+    else if (strncmp("<waitforchar",  str, 12) == 0)
+    { 
+      if (curPage == NULL)
+      {
+        fprintf(stderr,
+               "CRITICAL XML ERROR: <waitforchar> should be in a <page> in file %s line (todo)",
+               fn);
+        exit(1);
+      }
+
+      if (curPage->items == NULL)
+      {
+        curItem = (itemType*)calloc(1, sizeof(itemType));
+        curPage->items = curItem;
+      }
+      else
+      {
+        curItem->next = (itemType*)calloc(1, sizeof(itemType));
+        curItem = curItem->next;
+      }
+
+      curItem->type = itemWFCH;
+    }
+    else if (strncmp("</",str, 2) == 0)
+    {
+      /* do nothing */
+    }
+    else
+      fprintf(stderr, "not recognized: %s\n", str); 
+
+  } while(!feof(f));
+
+  fclose(f);
+
+  LOG("Leave load_script()\n");
+
+  return 0;
+}
+
+
+static void run_script(void)
+{
+  /* FIXME FNLEN doesn't make sense for size of these arrays */
+  Mix_Chunk* sounds[FNLEN] = {NULL};
+
+  /* --- for on mouse click on an image --- */
+  Mix_Chunk* clickWavs[FNLEN] = {NULL};
+  SDL_Rect   clickRects[FNLEN];
+
+  LOG("\nEnter run_script()\n");
+
+  if (!curScript)
+  {
+    fprintf(stderr, "run_script() - Error: curScript is NULL\n");
+    return;
+  }
+
+  curPage = curScript->pages;
+
+  while (curPage)
+  {
+    int y = 0;
+    int skip = 0;
+    int numWavs = 0;
+    int numClicks = 0;
+
+    curItem = curPage->items;
+
+    /* --- setup background color --- */
+    if (curPage->bgcolor)
+      SDL_FillRect( screen, NULL, COL2RGB(curPage->bgcolor));
+    else if (curScript->bgcolor)
+      SDL_FillRect(screen, NULL, COL2RGB(curScript->bgcolor));
+
+    /* --- setup background image --- */
+    if (curPage->background)
+    {
+      SDL_Surface* img = LoadImage(curPage->background, IMG_ALPHA|IMG_NOT_REQUIRED);
+      SDL_BlitSurface(img, NULL, screen, NULL);
+      SDL_FreeSurface(img);
+    }
+    else if (curScript->background)
+    {
+      SDL_Surface* img = LoadImage(curScript->background, IMG_ALPHA|IMG_NOT_REQUIRED);
+      SDL_BlitSurface(img, NULL, screen, NULL);
+      SDL_FreeSurface(img);
+    }
+
+    /* --- go through all the items in the page --- */
+    while (curItem)
+    {
+      switch (curItem->type)
+      {
+        case itemIMG:
+        {
+          SDL_Surface* img = LoadImage(curItem->data, IMG_ALPHA|IMG_NOT_REQUIRED);
+          if (img)
+          {
+            /* --- figure out where to put it! --- */
+            SDL_Rect loc;
+            loc.w = img->w;
+            loc.h = img->h;
+
+            /* --- if user specifies y location, use it --- */
+            if (curItem->y >= 0)
+            {
+              loc.y = curItem->y;
+            }
+            else
+            {
+              loc.y = y;
+              y += loc.h;
+            }
+
+            /* --- if user specifies x location, use it --- */
+            if (curItem->x >= 0)
+            {
+              loc.x = curItem->x;
+            }
+            else
+            {
+              switch (curItem->align)
+              {
+                case 'r':
+                  loc.x = (screen->w) - (loc.w);
+                  break;
+                case 'c':
+                  loc.x = ((screen->w) - (loc.w))/2;
+                  break;
+                default:
+                  loc.x = 0;
+                  break;
+              }
+            }
+
+            /* --- and blit! --- */
+            SDL_BlitSurface(img, NULL, screen, &loc);
+
+            /* --- does it do click and play --- */
+            if (curItem->onclick)
+            {
+              if (settings.sys_sound)
+                clickWavs[numClicks] = LoadSound(curItem->onclick);
+              clickRects[numClicks].x = loc.x;
+              clickRects[numClicks].y = loc.y;
+              clickRects[numClicks].w = loc.w;
+              clickRects[numClicks].h = loc.h;
+              numClicks++;
+            }
+          }
+          SDL_FreeSurface(img);
+          break;
+        }
+
+        case itemTEXT:
+        {
+          TTF_Font* myFont;
+          SDL_Surface* img;
+          SDL_Color* col;
+
+          int shown, toshow, w, h; // used to wrap text
+          char tmp[FNLEN];   // used to hold temp text for wrapping
+
+          /* --- create font & render text --- */
+          if (curItem->size > 0)
+            myFont = LoadFont(settings.theme_font_name, (int)curItem->size);
+          else
+            myFont = LoadFont(settings.theme_font_name, 24); // default size is 24
+
+          if (curItem->color)
+            col = curItem->color;
+          else if (curPage->fgcolor)
+            col = curPage->fgcolor;
+          else if (curScript->fgcolor)
+            col = curScript->fgcolor;
+          else 
+            col = &white;
+
+          shown = 0;
+
+
+          do 
+          {
+            int ok = 0;
+
+            if ((shown > 0) && (curItem->data[shown] == ' '))
+              shown++;
+            strncpy(tmp, &curItem->data[shown], FNLEN - 1);
+            tmp[FNLEN - 1] = 0;
+            tmp[strlen(curItem->data) - shown] = 0;
+
+            for (toshow = strlen(&curItem->data[shown]); !ok; toshow--)
+            {
+              if (toshow + 1 > FNLEN)
+                continue;
+
+              tmp[toshow] = 0;
+              TTF_SizeText(myFont, tmp, &w, &h);
+
+              if (w + 20 < screen->w)
+                ok = 1;
+            }
+
+            shown += toshow + 1;
+
+            img = TTF_RenderUTF8_Blended(myFont, tmp, *col);
+
+            if (img)
+            {
+              SDL_Rect loc;
+              /* --- figure out where to put it! --- */
+              loc.w = img->w;
+              loc.h = img->h;
+
+              /* --- if user specifies y location, use it --- */
+              if (curItem->y >= 0)
+                loc.y = curItem->y;
+              else 
+                loc.y=y; y+=loc.h;
+
+              /* --- if user specifies x location, use it --- */
+              if (curItem->x >= 0)
+                loc.x = curItem->x;
+              else 
+              {
+                switch (curItem->align)
+                {
+                  case 'r':
+                    loc.x = (screen->w) - (loc.w);
+                    break;
+                  case 'c':
+                    loc.x = ((screen->w) - (loc.w))/2;
+                    break;
+                  default:
+                    loc.x = 0;
+                  break;
+                }
+              }
+
+              /* --- and blit! --- */
+              SDL_BlitSurface( img, NULL, screen, &loc );
+              SDL_FreeSurface( img );
+            }
+                    
+          } while (shown + 1 < strlen(curItem->data));
+
+          TTF_CloseFont(myFont);
+          break;
+        }
+
+
+        case itemWAV:
+        {
+          // HACK, we need to make sure no more than 8 sounds or so..
+          sounds[numWavs] = LoadSound( curItem->data );
+          Mix_PlayChannel( numWavs, sounds[numWavs], -curItem->loop );
+          numWavs++;
+          break;
+        }
+
+
+        case itemWFIN:
+        {
+          int done = 0;
+
+          // Make sure everything is on screen 
+          SDL_Flip(screen);
+
+          while (!done)
+          {
+            SDL_Delay(100);
+
+            while (SDL_PollEvent(&event))
+            {
+              switch (event.type)
+              {
+                case SDL_MOUSEBUTTONDOWN:
+                {
+                  int j;
+
+                  for (j=0; j<numClicks; j++) 
+                  {
+                    if (inRect(clickRects[j], event.button.x, event.button.y))
+                     Mix_PlayChannel(numWavs + j, clickWavs[j], 0);
+                  }
+                  break;
+                }
+
+                case SDL_QUIT:
+                {
+                  curPage = NULL;
+                  done = 1;
+                  break;
+                }
+
+                case SDL_KEYDOWN: 
+                {
+                  switch (event.key.keysym.sym)
+                  {
+                    case SDLK_ESCAPE: 
+                      curPage = NULL;
+                      done = 1;
+                      break;  // quit
+                    case SDLK_LEFT: 
+                      curPage = curPage->prev;
+                      done = 1;
+                      break;
+                    case SDLK_RIGHT:
+                    case SDLK_SPACE:
+                    case SDLK_RETURN:
+                      curPage = curPage->next;
+                      skip = 1;
+                      done = 1;
+                      break;
+                    default:
+                      break;
+                  };
+
+                  break;
+                }
+              }
+            }
+          }
+        }
+        break;
+
+
+        case itemWFCH:
+        {
+          int done = 0;
+          // Make sure everything is on screen 
+          SDL_Flip(screen);
+
+          while (!done)
+          {
+            SDL_Delay(100);
+            while (SDL_PollEvent(&event))
+            {
+              switch (event.type)
+              {
+                case SDL_QUIT:
+                {
+                  curPage = NULL;
+                  done = 1;
+                  break;
+                }
+
+                case SDL_KEYDOWN: 
+                {
+                  switch (event.key.keysym.sym)
+                  {
+                    case SDLK_ESCAPE: 
+                    {
+                      curPage = NULL;
+                      done = 1;
+                      break;  // quit
+                    }
+                    case SDLK_p:
+                    {
+                      curPage = curPage->next;
+                      done = 1;
+                      break;
+                    }
+                    default:
+                      break;
+                  };
+                  break;
+                }
+              }
+            }
+          }
+        }
+        break;
+
+        case itemPRAC:
+        {
+          wchar_t wide_buf[FNLEN];
+          ConvertFromUTF8(wide_buf, curItem->data);
+          if (curItem->goal > 0)
+          {
+            //printf( "goal is %d\n", curItem->goal );
+            Phrases(wide_buf);
+          }
+          else
+          {
+            //printf( "No goal \n" );
+            Phrases(wide_buf);
+          }
+          break;
+        }
+
+        default:
+        {
+          /* do nothing */
+        }
+      }
+
+      if (curItem->next == NULL && curPage != NULL)
+      {
+        if (!skip)
+        {
+          curPage = curPage->next;
+          skip = 0;
+        }
+        break;
+      }
+      else
+        curItem = curItem->next;
+    }
+    SDL_Flip(screen);
+    SDL_Delay(30);
+        
+        
+    /* --- cleanup memory --- changing pages --- */
+    { 
+      int i;
+
+      if (settings.sys_sound)
+      {
+        for (i=0; i<numWavs; i++)
+        {
+          Mix_HaltChannel(i);
+          Mix_FreeChunk(sounds[i]);
+        }
+
+        for (i = 0; i < numClicks; i++)
+        {
+          Mix_HaltChannel(i + numWavs);
+          Mix_FreeChunk(clickWavs[i]);
+        }
+      }
+    }
+
+  } /* --- End of "while (curPage)" loop ----*/
+
+  LOG("Leave run_script()\n");
+}
+
+
+static void clear_items(itemType* i)
+{
+    itemType* n;
+
+    /* if i is null, will return harmlessly: */
+    while (i) {
+        n = i->next;  // remember the next guy
+
+        /* -- remove any data we are pointing to -- */
+        free(i->data);
+        free(i->onclick);
+        free(i->color);
+
+        /* -- remove ourselves --*/
+        free(i);
+
+        /* -- on to the next guy! -- */
+        i = n;
+    }
+}
+
+static void clear_pages(pageType* p)
+{
+    pageType* n;
+
+    /* if p is null, will return harmlessly: */
+    while (p) {
+        n = p->next;  // remember the next guy
+
+        /* -- remove all of our sub elements -- */
+        clear_items(p->items);
+
+        /* -- free anything we are pointing to --- */
+        free(p->background);
+        free(p->title);
+        free(p->bgcolor);
+        free(p->fgcolor);
+
+        /* -- free ourselves -- */
+        free(p);
+
+        /* -- on to the next --*/
+        p = n;
+    }
+}
+
+
+static void close_script(void)
+{
+  if (curScript)
+  {
+    /* -- remove all the pages we have --*/
+    clear_pages(curScript->pages);
+
+    /* -- remove attributes we are pointing to -- */
+    free(curScript->title);
+    free(curScript->bgcolor);
+    free(curScript->fgcolor);
+    free(curScript->background);
+
+    /* -- free yourself -- */
+    free(curScript); 
+
+    /* -- and remember you did -- */
+    curScript = NULL;
+  }
+}
+
+
+
+

Added: tuxtype/branches/tuxtype-reorg/src/scripting.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/scripting.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/scripting.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,64 @@
+/***************************************************************************
+ -  file: scripting.h
+ -  description: types for scripting 
+-------------------
+    begin                : Sun Dec 28, 2003
+    copyright            : Jesse Andrews (C) 2003
+    email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+enum { itemTEXT, itemIMG, itemWAV, itemPRAC, itemWFIN, itemWFCH };
+
+/* linked list of elements for a page */
+struct item {
+        char type;		// text or img or wav enum type?
+        char *data;		// holds text/location for file (sound/image)
+        char *onclick;		// holds additional data
+        char size;		// holds font size if applicable
+        char align;             // holds 'L'eft, 'R'ight, 'C'enter for alignment
+        char loop;		// holds if sound files loop
+        int  goal;		// goal for practice session
+	int  x,y;		// for absolute positioning
+        SDL_Color *color;       // holds text color
+        
+        struct item *next; // the linked list part ... 
+};
+
+typedef struct item itemType;
+
+/* linked list of pages for a lesson */
+struct page {
+    itemType *items;	// linked list of elements
+    char *background;		// background image
+    char *title;		// title of the page
+    SDL_Color *bgcolor;		// background color
+    SDL_Color *fgcolor;		// default text color
+    
+    struct page *next;         // the linked list part ...
+    struct page *prev;         // the doubly-linked list part ...
+};
+
+typedef struct page pageType;
+
+struct script {
+    pageType *pages;		// linked list of pages
+    char *title;		// title of lesson
+    SDL_Color *bgcolor;         // default background color for all pages
+    SDL_Color *fgcolor;         // default foreground color for all text
+    char *background;		// default background image for all pages
+}; 
+
+typedef struct script scriptType;
+

Added: tuxtype/branches/tuxtype-reorg/src/setup.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/setup.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/setup.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,446 @@
+/***************************************************************************
+                          setup.c 
+ -  description: Init SDL
+                             -------------------
+    begin                : Thu May 4 2000
+    copyright            : (C) 2000 by Sam Hart
+                         : (C) 2003 by Jesse Andrews
+    email                : tuxtype-dev at tux4kids.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+#define NUM_PATHS 4
+
+const char PATHS[NUM_PATHS][FNLEN] = 
+{
+  "./data",
+  "/usr/share/"PACKAGE"/data",
+  "/usr/local/share/"PACKAGE"/data",
+  DATA_PREFIX"/share/"PACKAGE"/data"
+};
+
+
+/* Local function prototypes: */
+static int load_settings_fp(FILE* fp);
+static int load_settings_filename(const char* fn);
+
+/***************************
+	GraphicsInit: Initializes the graphic system
+****************************/
+void GraphicsInit(Uint32 video_flags)
+{
+	LOG( "GraphicsInit - Initialize graphic system\n" );
+
+	DEBUGCODE {
+		fprintf(stderr, "-SDL Setting VidMode to %ix%ix%i\n", RES_X, RES_Y, BPP);
+	}
+
+	/* NOTE fullscreen vs. windowed is indicated by video_flags */
+	screen = SDL_SetVideoMode(RES_X, RES_Y, BPP, video_flags);
+
+	if (screen == NULL) {
+		fprintf(stderr, "Couldn't set %ix%i video mode: %s\n", RES_X, RES_Y, SDL_GetError());
+		exit(2);
+	}
+
+
+	LOG( "SDL_SetClipRect(screen, NULL):\n" );
+
+	SDL_SetClipRect(screen, NULL); // Let's set the appropriate clip rect  -- JA: is neccessary???  
+
+	LOG( "SDL_ShowCursor(0):\n" );
+
+	SDL_ShowCursor(0); // no cursor please
+
+	LOG( "SDL_WM_SetCaption(\"Tux Typing\", PACKAGE);\n" );
+
+	SDL_WM_SetCaption("Tux Typing", "tuxtype"); // Set window manager stuff
+
+	/* --- setup color we use --- */
+	black.r       = 0x00; black.g       = 0x00; black.b       = 0x00;
+        gray.r        = 0x80; gray.g        = 0x80; gray.b        = 0x80;
+	dark_blue.r   = 0x00; dark_blue.g   = 0x00; dark_blue.b   = 0x60; 
+	red.r         = 0xff; red.g         = 0x00; red.b         = 0x00;
+	white.r       = 0xff; white.g       = 0xff; white.b       = 0xff;
+	yellow.r      = 0xff; yellow.g      = 0xff; yellow.b      = 0x00; 
+
+	InitEngine();
+
+	DEBUGCODE {
+		fprintf(stderr, "-SDL VidMode successfully set to %ix%ix%i\n", RES_X, RES_Y, BPP);
+	}
+
+	LOG( "GraphicsInit():END\n" );
+}
+
+/****************************
+	LibInit : Init the SDL
+	library
+*****************************/
+void LibInit(Uint32 lib_flags)
+{
+	LOG( "LibInit():\n-About to init SDL Library\n" );
+
+	if (SDL_Init(lib_flags) < 0) 
+		/* FIXME this looks wrong - if no sys_sound, we don't init video??? */
+		if (settings.sys_sound) {
+			if (SDL_Init(SDL_INIT_VIDEO) < 0) {
+				fprintf(stderr, "Couldn't initialize SDL: %s\n",
+				SDL_GetError());
+				exit(2);
+			} else {
+				LOG( "Couldn't initialize SDL Sound\n" );
+				settings.sys_sound = 0;
+			}
+		}
+
+
+//	atexit(SDL_Quit); // fire and forget... 
+
+	LOG( "-SDL Library init'd successfully\n" );
+
+	/* FIXME should read settings before we do this: */ 
+	if (settings.sys_sound)
+        { 
+          if (Mix_OpenAudio(22050, AUDIO_S16, 1, 2048) == -1)
+          {
+            fprintf( stderr, "Warning: couldn't set 22050 Hz 8-bit audio\n - Reasons: %s\n", SDL_GetError());
+            settings.sys_sound=0;
+          }
+          else
+            LOG("Mix_OpenAudio() successful\n");
+        }
+
+	LOG( "-about to init SDL_ttf\n" );
+
+	if (TTF_Init() < 0) {
+		fprintf( stderr, "Couldn't initialize SDL_ttf\n" );
+		exit(2);
+	}
+
+//	atexit(TTF_Quit);
+
+	SDL_EnableKeyRepeat( 0, SDL_DEFAULT_REPEAT_INTERVAL );
+	/* Need this to get Unicode values from keysyms: */
+	SDL_EnableUNICODE(1);
+
+	LOG( "LibInit():END\n" );
+}
+
+/* Load the settings from a file... make sure to update SaveSettings if you change
+ *  what can be saved/loaded 
+ */
+void LoadSettings(void)
+{
+  char fn[FNLEN];
+// 	char setting[FNLEN];
+// 	char value[FNLEN];
+//	FILE *settingsFile;
+	
+  /* set the settings directory/file */
+
+#ifdef WIN32
+  snprintf(fn, FNLEN - 1, "userdata/settings.txt");
+  LOG("WIN32 defined\n");
+#else
+  snprintf(fn, FNLEN - 1, (const char*)"%s/.tuxtype/settings.txt", getenv("HOME"));
+  LOG("WIN32 not defined\n");
+#endif
+
+  DEBUGCODE { printf("LoadSettings: settings file is '%s'\n", fn ); }
+
+  LOG("LoadSettings: trying to open settings file\n");
+
+  load_settings_filename(fn);
+}
+
+
+
+/* Load the settings if given the complete pathname to the settings file.  Returns 1 if
+   able to call load_settings_fp() successfully on named file.
+ */
+static int load_settings_filename(const char* fn)
+{
+  FILE* fp = fopen(fn, "r");
+
+  if (!fp)
+  {
+    fprintf(stderr, "load_settings_filename(): no theme-specific settings found\n");
+    return;
+  }
+	
+  if (!load_settings_fp(fp))
+  {
+    fprintf(stderr, "No settings in settings file.\n");
+    fclose(fp); /* still need to close fp */
+    return 0;
+  }
+
+  /* Success! */
+  fclose(fp);
+  return 1;
+}
+
+
+/* Load the settings if given an open FILE* pointer to the settings file.  Returns 1 if
+   at least one setting value found, 0 otherwise. It does not close the FILE*.
+ */
+static int load_settings_fp(FILE* fp)
+{
+  char setting[FNLEN]; /* these don't really need to be 'FNLEN' long */
+  char value[FNLEN];
+  int setting_found = 0;
+
+  if (!fp)
+  {
+    fprintf(stderr, "load_settings_fp() - FILE* parameter NULL\n");
+    return 0;
+  }
+
+  /* we load all the settings here */
+  while (!feof(fp))
+  {
+    fscanf(fp, "%[^=]=%[^\n]\n", setting, value );
+
+    DEBUGCODE {fprintf(stderr, "%s = %s", setting, value );}
+
+    if (strncmp( setting, "lang", FNLEN ) == 0 )
+    {
+      DEBUGCODE {fprintf(stderr, "LoadSettings: Setting language to %s", value);}
+      strncpy(settings.lang, value, FNLEN - 1);
+      setting_found = 1;
+      SetupPaths(value); /* Does this really belong here? */ 
+    }
+    else if (strncmp( setting, "o_lives", FNLEN ) == 0 )
+    {
+      DEBUGCODE {fprintf(stderr, "LoadSettings: Setting lives to %s", value);}
+      settings.o_lives = atoi(value);
+      setting_found = 1;
+   }
+    else if (strncmp( setting, "mus_volume", FNLEN ) == 0 )
+    {
+      DEBUGCODE {fprintf(stderr, "LoadSettings: Setting music volume to %s", value);}
+      settings.mus_volume = atoi(value);
+      setting_found = 1;
+    }
+    else if (strncmp(setting, "sfx_volume", FNLEN) == 0)
+    {
+      DEBUGCODE {fprintf(stderr, "LoadSettings: Setting effects volume to %s", value);}
+      settings.sfx_volume = atoi(value);
+      setting_found = 1;
+    }
+    else if (strncmp(setting, "menu_music", FNLEN) == 0)
+    {
+      DEBUGCODE {fprintf(stderr, "LoadSettings: Setting menu music to %s", value);}
+      settings.menu_music = atoi(value);
+      setting_found = 1;
+    }
+    else if (strncmp( setting, "fullscreen", FNLEN ) == 0 )
+    {
+      settings.fullscreen = atoi(value);
+      setting_found = 1;
+    }
+    else if (strncmp( setting, "theme_font_name", FNLEN ) == 0 )
+    {
+      DEBUGCODE {fprintf(stderr, "load_settings_fp(): Setting theme font to %s", value);}
+      strncpy(settings.theme_font_name, value, FNLEN - 1);
+      setting_found = 1;
+    }
+    else
+      DEBUGCODE {fprintf(stderr, "load_settings_fp(): unrecognized string: %s", value);}
+
+  }
+
+
+  if (setting_found)
+    return 1;
+  else
+  {
+    fprintf(stderr, "load_settings_fp() - no settings in file - empty or corrupt?\n");
+    return 0;
+  }
+}
+
+
+
+/* Save the settings from a file... make sure to update LoadSettings if you change
+ *  what can be saved/loaded 
+ */
+void SaveSettings(void)
+{
+	char fn[FNLEN];
+	FILE* settingsFile;
+	
+	/* set the settings directory/file */
+
+	#ifdef WIN32
+		_mkdir( "userdata" );  // just in case try to create save location
+		snprintf( fn, FNLEN-1, "userdata/settings.txt" );
+	#else
+		snprintf( fn, FNLEN-1, (const char*)"%s/.tuxtype", getenv("HOME") );
+		mkdir( fn, 0755 ); // just in case try to create save location
+		snprintf( fn, FNLEN-1, (const char*)"%s/.tuxtype/settings.txt", getenv("HOME") );
+	#endif
+
+
+	DEBUGCODE { printf("SaveSettings: settings file is '%s'\n", fn ); }
+	
+	LOG("SaveSettings: trying to open settings file\n");
+	
+	settingsFile = fopen( fn, "w" );
+
+	if (settingsFile == NULL) {
+		printf("SaveSettings: Settings file cannot be created!\n");
+		return;
+	}
+	
+	/* Save all the settings here! */
+	if (strncmp(settings.theme_name, "", FNLEN) != 0)
+		fprintf( settingsFile, "lang=%s\n", settings.theme_name );
+	if (settings.o_lives > 9)
+		fprintf( settingsFile, "o_lives=%d\n", settings.o_lives );
+
+	fprintf( settingsFile, "mus_volume=%d\n", settings.mus_volume );
+	fprintf( settingsFile, "sfx_volume=%d\n", settings.sfx_volume );
+	fprintf( settingsFile, "menu_music=%d\n", settings.menu_music );
+	fprintf( settingsFile, "fullscreen=%d\n", settings.fullscreen);
+
+
+// 	if (screen->flags & SDL_FULLSCREEN){
+// 		fprintf( settingsFile, "fullscreen=%s\n", "1");
+// 	} else {
+// 		fprintf( settingsFile, "fullscreen=%s\n", "0");
+// 	}
+	fclose(settingsFile);
+}
+
+
+/* Check for default (English) and theme data paths and update settings struct. */
+/* Returns 0 if default data path not found, 1 if successfully located.         */
+/* If theme not found, still returns 1 but settings changed to use English.     */
+/* TODO should have this function set up the user and global settings paths.    */
+/* TODO settings should be re-loaded when theme changes.                        */
+
+int SetupPaths(const char* theme_dir)
+{
+  int i;
+  settings.use_english = 1; // default is to use English if we cannot find theme
+
+  /* First find default data path: */
+  for (i = 0; i < NUM_PATHS; i++)
+  {
+
+    DEBUGCODE
+    {
+      fprintf(stderr, "SetupPaths(): checking for '%s' as default data path\n", PATHS[i]);
+    }
+
+    if (CheckFile(PATHS[i]))
+    {
+      strncpy(settings.default_data_path, PATHS[i], FNLEN - 1);
+
+      DEBUGCODE
+      {
+        fprintf(stderr, "path '%s' found, copy to settings.default_data_path\n", PATHS[i]);
+      }
+      break;
+    }
+    else
+    {
+      DEBUGCODE
+      {
+        fprintf(stderr, "path '%s' not found.\n", PATHS[i]);
+      }
+    }
+  }
+
+  /* If we didn't find a data path, print error msg and get out: */
+  if (i >= NUM_PATHS) /* (shouldn't actually ever be > NUM_PATHS) */
+  {
+    fprintf(stderr, "SetupPaths(): Error - could not find data path.\n");
+    return 0;
+  }
+
+
+  /* Now look for theme directory: */
+  if (theme_dir != NULL)
+  {
+    char full_theme_path[FNLEN];
+    char theme_settings_path[FNLEN];
+
+    sprintf(full_theme_path, "%s/themes/%s", settings.default_data_path, theme_dir);
+
+    DEBUGCODE
+    {
+      fprintf(stderr, "SetupPaths(): checking for '%s' as theme path\n", full_theme_path);
+    }
+
+    if (CheckFile(full_theme_path)) /* Theme found - set it up! */
+    {
+      settings.use_english = 0;
+      strncpy(settings.theme_data_path, full_theme_path, FNLEN - 1);
+      DEBUGCODE
+      {
+        fprintf(stderr, "settings.theme_data_path is: %s\n", settings.theme_data_path);
+      }
+ 
+      strncpy(settings.theme_name, theme_dir, FNLEN - 1);
+      /* (Need to do this in case we are changing from a theme with */
+      /* a special font to a theme that uses the default, but lacks */
+      /* an explicit statement to use the default(                  */
+      strncpy(settings.theme_font_name, DEFAULT_MENU_FONT, FNLEN);
+
+      /* Load fontname or any other theme-specific settings: */
+      sprintf(theme_settings_path, "%s/settings.txt", full_theme_path);
+
+      DEBUGCODE
+      {
+        fprintf(stderr, "theme_settings_path is: %s\n", theme_settings_path);
+      }
+
+      load_settings_filename(theme_settings_path);
+    }
+    else /* Theme not found! */
+    {
+      settings.use_english = 1; // default is to use English if we cannot find theme
+      strcpy(settings.theme_name, "");
+      strncpy(settings.theme_font_name, DEFAULT_MENU_FONT, FNLEN);
+      fprintf(stderr, "SetupPaths(): could not find '%s'\n", full_theme_path);
+    }
+  }
+  else /* No theme name passed as arg so just use English: */
+  {
+    settings.use_english = 1; // default is to use English if we cannot find theme
+    strcpy(settings.theme_name, "");
+  }
+
+
+  DEBUGCODE
+  {
+    fprintf(stderr, "Leaving SetupPaths():\n");
+    fprintf(stderr, "default_data_path: '%s'\n", settings.default_data_path);
+    fprintf(stderr, "theme_data_path: '%s'\n\n", settings.theme_data_path);
+  }
+  return 1;	
+}
+
+
+void Cleanup(void)
+{
+  SDL_FreeSurface(screen);
+  screen = NULL;
+
+  SDL_Quit();
+  TTF_Quit();
+}

Added: tuxtype/branches/tuxtype-reorg/src/snow.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/snow.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/snow.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,272 @@
+/***************************************************************************
+ -  file: snow.c
+ -  description: this file contains snow for the cascade game
+-------------------
+begin                : March 12, 2003
+copyright            : (C) 2003 Jesse Andrews
+email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+*                                                                         *
+*   This program is free software; you can redistribute it and/or modify  *
+*   it under the terms of the GNU General Public License as published by  *
+*   the Free Software Foundation; either version 2 of the License, or     *
+*   (at your option) any later version.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include <stdlib.h>
+#include "SDL.h"
+
+/* while it looks like you can just
+ * change the number of planes, flakes,
+ * etc and it will work all right, it is not
+ * true.  Do not fiddle with number unless you
+ * change the rest of the code to be the same!
+ */
+
+#define NUM_PLANES 3
+
+extern SDL_Surface *screen;
+SDL_Surface* bkg;
+
+Uint16 snow_color;
+
+int wind = 0;
+int SNOW_on = 0;
+
+int NUM_FLAKES = 300;
+int PER_PLANE = 100; // should equal NUM_FLAKES/NUM_PLANES
+
+/* to get the real x location divide by 8 (>>3)
+ */
+struct {
+	int x;
+	int y;
+} flake[300];
+
+/* used for the SDL_UpdateRects */
+SDL_Rect SNOW_rects[1000];
+
+/* pass add_wind +/- 1 --- it just adds a fraction in that direction! */
+void add_wind( int dir ) {
+
+	/* don't let the wind blow too hard */
+	if ( wind * dir > 16 )
+		return;
+	
+	if (dir > 0)
+		wind++;
+	else
+		wind--;
+}
+
+/* ### INTERNAL FUNCTION ### 
+ * move_snow: updates the location of the flakes
+ * based upon the wind and different "planes"
+ * of the flakes
+ */
+void move_snow(void) {
+	int i;
+	static int slowframe=1;
+	int ws=wind;
+
+	slowframe = !slowframe;
+	/* even though we only move the "slowest" every other frame,
+	 * the code is still updating them every single frame!!!
+	 * the SNOW_Rect data structure will need to be updated to fix this!
+	 * slowframe just cycles between updating the slowest and not!
+	 */
+	if (slowframe) {
+		for (i = 0; i<PER_PLANE; i++) {
+			flake[i].x += ws;
+			flake[i].y ++;
+		}
+	}
+
+	for (i = PER_PLANE; i<PER_PLANE<<1; i++) {
+		flake[i].x += ws;
+		flake[i].y += 1;
+	}
+
+	ws<<=1;
+	for (i = PER_PLANE<<1; i<NUM_FLAKES; i++) {
+		flake[i].x += ws;
+		flake[i].y += 2;
+	} 
+
+	for (i = 0; i<NUM_FLAKES; i++) {
+		/* if a flake hits the bottom, move to top randomly */
+		if (flake[i].y >= 478) {
+			flake[i].y = 0;
+			flake[i].x = (int)(8*639.0*rand()/(RAND_MAX+1.0));
+		}
+
+		/* if a flake hists the edge, move to the other edge randomly */
+		if (flake[i].x >= 638<<3) {
+			flake[i].x = 0;
+			flake[i].y = (int)(478.0*rand()/(RAND_MAX+1.0));
+		} else if (flake[i].x < 0) {
+			flake[i].x = 8*637;
+			flake[i].y = (int)(478.0*rand()/(RAND_MAX+1.0));
+		}
+
+		/* the first NUM_FLAKES are for erasing the last frame's FLAKES */
+		SNOW_rects[i].x = SNOW_rects[NUM_FLAKES+i].x;
+		SNOW_rects[i].y = SNOW_rects[NUM_FLAKES+i].y;
+		/* the next NUM_FLAKES are for bliting the new positions this frame */
+		SNOW_rects[NUM_FLAKES+i].x = flake[i].x>>3;
+		SNOW_rects[NUM_FLAKES+i].y = flake[i].y;
+	}
+}
+
+/* SNOW_draw: updates the screen surface
+ * with the new flake pixels
+ * note: y<<9 + y<<7 is short for y*640
+ */
+void SNOW_draw(void) {
+	int i;
+	Uint16 *to;
+
+	/* we only draw if we are on and haven't toggled (see SNOW_Erase for more info */
+	if (SNOW_on!=1)
+		return;
+
+	for (i=0; i<NUM_FLAKES; i++) {
+		to = screen->pixels;
+		to += (SNOW_rects[NUM_FLAKES+i].y<<9) + (SNOW_rects[NUM_FLAKES+i].y<<7) + SNOW_rects[NUM_FLAKES+i].x;
+		*to = snow_color;
+		to += 1;
+		*to = snow_color;
+		to += 640;
+		*to = snow_color;
+		to -= 1;
+		*to = snow_color;
+	}
+}
+
+/* SNOW_erase: updates the screen surface
+ * by replacing the previous flakes with
+ * the background image (set via SNOW_setBkg).
+ * This should be run before bliting any
+ * graphics to the screen so you don't over-
+ * write good images with background!
+ *
+ * note: y<<9 + y<<7 is short for y*640
+ */
+void SNOW_erase(void) {
+	int i;
+	Uint16 *from, *to;
+
+	if (!SNOW_on)
+		return;
+
+	/* SNOW_on isn't a boolean variable, it is really
+	 * holding the state:
+	 *  0 means no snow
+	 *  1 means snow
+	 *  2 means the user has requested snowing to stop
+	 *          we cannot just stop snowing since we
+	 *          need to erase the previous frames snow
+	 *  3 means have erased the snow during the previous
+	 *          frame and can go back to waiting for
+	 *          snow to be turned on
+	 */
+	if (SNOW_on>1) {
+		if (SNOW_on == 3)
+			SNOW_on = 0;
+		else
+			SNOW_on++;
+	}
+
+	for (i=0; i<NUM_FLAKES; i++) {
+		to = screen->pixels;
+		from = bkg->pixels;
+		to += (SNOW_rects[i].y<<9) + (SNOW_rects[i].y<<7) + SNOW_rects[i].x;
+		from += (SNOW_rects[i].y<<9) + (SNOW_rects[i].y<<7) + SNOW_rects[i].x;
+		*to = *from;
+		to += 1;
+		from += 1;
+		*to = *from;
+		to += 640;
+		from += 640;
+		*to = *from;
+		to -= 1;
+		from -= 1;
+		*to = *from;
+	}
+}
+
+/* SNOW_setBkg: we need to have the  background
+ * to erase snow flakes every frame
+ */
+void SNOW_setBkg( SDL_Surface *img ) {
+	bkg = img;
+}
+
+/* SNOW_add: this adds the other rectangles that we need 
+ * to update on the screen to the list and returns
+ * the total number of items on the complete list
+ * (flakes & regular stuff)
+ */
+int SNOW_add( SDL_Rect *rs, int num ){
+	int i;
+	for (i=0; i<num; i++) {
+		SNOW_rects[(NUM_FLAKES<<1)+i].x = rs[i].x;
+		SNOW_rects[(NUM_FLAKES<<1)+i].y = rs[i].y;
+		SNOW_rects[(NUM_FLAKES<<1)+i].w = rs[i].w;
+		SNOW_rects[(NUM_FLAKES<<1)+i].h = rs[i].h;
+	}
+	return num + (NUM_FLAKES<<1);
+}
+
+/* SNOW_init: initing the snow "library" envoles
+ * seting up the color for the snow, the inital
+ * locations for the flakes and the size of the
+ * snow rectangles
+ */
+void SNOW_init( void ) {
+
+	int i;
+
+	snow_color = SDL_MapRGB( screen->format, 255, 255, 255 );
+	for (i=0; i<NUM_FLAKES; i++) {
+		flake[i].x = (int)(8*638.0*rand()/(RAND_MAX+1.0));
+		flake[i].y = (int)(480.0*rand()/(RAND_MAX+1.0));
+	}
+	for (i=0; i<2*NUM_FLAKES; i++) {
+		SNOW_rects[i].w = 2;
+		SNOW_rects[i].h = 2;
+	}
+}
+
+/* SNOW_toggle: toggles the snow on and off.
+ * see SNOW_erase for a discription of what
+ * SNOW_on means
+ */
+void SNOW_toggle( void ) {
+	SNOW_on ++;
+}
+
+/* SNOW_update: update the wind with
+ * a 10% prob of blowing further left
+ * a 10% prob of blowing further right
+ * and 80% of not changing.
+ * AFTER updating the wind, we move all
+ * the snow
+ */
+void SNOW_update( void ) {
+	int rand_tmp = (int)(10.0*rand()/(RAND_MAX+1.0));
+
+	if (!SNOW_on)
+		return;
+
+	if (rand_tmp == 0)
+		add_wind(-1);
+	else if (rand_tmp == 1)
+		add_wind(+1);
+	
+	move_snow();
+}
+

Added: tuxtype/branches/tuxtype-reorg/src/snow.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/snow.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/snow.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,9 @@
+extern int SNOW_on;
+extern SDL_Rect SNOW_rects[2000];
+extern int SNOW_add( SDL_Rect *rs, int num );
+extern void SNOW_toggle( void );
+extern void SNOW_draw( void );
+extern void SNOW_erase( void );
+extern void SNOW_setBkg( SDL_Surface *img );
+extern void SNOW_init( void );
+extern void SNOW_update( void );

Added: tuxtype/branches/tuxtype-reorg/src/theme.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/theme.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/theme.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,287 @@
+/***************************************************************************
+                          theme.c 
+ -  description: theme related code
+                             -------------------
+    begin                : Jan 6 2003
+    copyright            : (C) 2003 by Jesse Andrews et al
+    email                : jdandr2 at tux4kids.net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+
+
+SDL_Surface* letters[255] = {NULL}; //get rid of this
+wchar_t ALPHABET[256];
+int ALPHABET_SIZE;
+
+
+#define MAX_LANGUAGES 100
+
+
+
+void ChooseTheme(void)
+{
+  SDL_Surface* titles[MAX_LANGUAGES] = {NULL};
+  SDL_Surface* select[MAX_LANGUAGES] = {NULL};
+  SDL_Surface* left = NULL, *right = NULL;
+  SDL_Rect leftRect, rightRect;
+  SDL_Surface* world = NULL, *map = NULL, *photo = NULL;
+  SDL_Surface* bkg = NULL;
+  TTF_Font* font = NULL;
+  SDL_Rect worldRect, photoRect;
+  SDL_Rect titleRects[8];
+  int stop = 0;
+  int loc = 0;
+  int old_loc = 1;
+
+  int themes = 1;
+  int i;
+  unsigned char fn[FNLEN];
+  unsigned char themeNames[MAX_LANGUAGES][FNLEN];
+  unsigned char themePaths[MAX_LANGUAGES][FNLEN];
+
+  int old_use_english;
+  char old_theme_path[FNLEN];
+
+  DIR* themesDir = NULL;
+  struct dirent* themesFile = NULL;
+
+  /* save previous settings in case we back out: */
+  old_use_english = settings.use_english;
+  strncpy(old_theme_path, settings.theme_data_path, FNLEN - 1);
+
+  sprintf(fn, "%s/themes/", settings.default_data_path);
+  themesDir = opendir(fn);
+
+  if (!themesDir)
+  {
+    fprintf(stderr, "ChooseTheme() - cannot open themes directory!");
+    return;
+  }
+
+  do
+  {
+    themesFile = readdir(themesDir);
+    if (!themesFile)
+			break;
+
+		/* we ignore any hidden file and CVS */
+
+		if (themesFile->d_name[0] == '.') 
+			continue;
+
+		if (strcmp("CVS", themesFile->d_name)==0)
+			continue;
+
+		/* check to see if it is a directory */
+		sprintf(fn, "%s/themes/%s", settings.default_data_path, themesFile->d_name);
+
+
+		/* CheckFile() returns 2 if dir, 1 if file, 0 if neither: */
+		if (CheckFile(fn) == 2) {
+		    /* HACK: we should get the names from file :) */
+		    strncpy( themeNames[themes], themesFile->d_name, FNLEN-1);
+		    /* Make sure theme name is capitalized: */
+                    themeNames[themes][0] = toupper(themeNames[themes][0]);
+		    strncpy( themePaths[themes++], themesFile->d_name, FNLEN-1 );
+		}
+	} while (1);
+
+	closedir(themesDir);
+
+	settings.use_english = 1;
+        // HACK: is font empty now???
+	font = LoadFont(settings.theme_font_name, MENU_FONT_SIZE);
+
+	titles[0] = BlackOutline( "English", font, &white );
+	select[0] = BlackOutline( "English", font, &yellow);
+	for (i = 1; i<themes; i++) {
+		titles[i] = BlackOutline( themeNames[i], font, &white );
+		select[i] = BlackOutline( themeNames[i], font, &yellow);
+	}
+
+	world = LoadImage("world.png", IMG_ALPHA);
+	worldRect.x = 480 - (world->w/2);
+	worldRect.w = world->w;
+	worldRect.y = 10;
+	worldRect.h = world->h;
+
+	
+
+	TTF_CloseFont(font);
+        font = NULL;
+
+	settings.use_english = old_use_english;
+
+	bkg = LoadImage("main_bkg.png", IMG_REGULAR);
+
+	left = LoadImage("left.png", IMG_ALPHA);
+	leftRect.w = left->w; leftRect.h = left->h;
+	leftRect.x = 160 - 80 - (leftRect.w/2); leftRect.y = 430;
+
+	right = LoadImage("right.png", IMG_ALPHA);
+	rightRect.w = right->w; rightRect.h = right->h;
+	rightRect.x = 160 + 80 - (rightRect.w/2); rightRect.y = 430;
+
+	/* set initial rect sizes */
+	titleRects[0].y = 30;
+	titleRects[0].w = titleRects[0].h = titleRects[0].x = 0;
+	for (i = 1; i<8; i++) {
+		titleRects[i].y = titleRects[i-1].y + 50;
+		titleRects[i].w = titleRects[i].h = titleRects[i].x = 0;
+	}
+	
+
+	while (!stop) {
+		while (SDL_PollEvent(&event)) 
+			switch (event.type) {
+				case SDL_QUIT:
+					exit(0);
+					break;
+				case SDL_MOUSEMOTION: 
+					for (i=0; (i<8) && (loc-(loc%8)+i<themes); i++)
+						if (inRect( titleRects[i], event.motion.x, event.motion.y )) {
+							loc = loc-(loc%8)+i;
+							break;
+						}
+					
+					break;
+				case SDL_MOUSEBUTTONDOWN: 
+					if (inRect( leftRect, event.button.x, event.button.y )) 
+						if (loc-(loc%8)-8 >= 0) {
+							loc=loc-(loc%8)-8;
+							break;
+						}
+					if (inRect( rightRect, event.button.x, event.button.y )) 
+						if (loc-(loc%8)+8 < themes) {
+							loc=loc-(loc%8)+8;
+							break;
+						}
+					for (i=0; (i<8) && (loc-(loc%8)+i<themes); i++) 
+						if (inRect(titleRects[i], event.button.x, event.button.y)) {
+							loc = loc-(loc%8)+i;
+							if (loc) {
+								/* --- set theme --- */
+								SetupPaths(themePaths[loc]);
+							} else {
+								/* --- english --- */
+								SetupPaths(NULL);
+							}
+							stop = 1;
+							break;
+						}
+					break;
+				case SDL_KEYDOWN:
+					if (event.key.keysym.sym == SDLK_ESCAPE) { 
+						settings.use_english = old_use_english;
+						strncpy(settings.theme_data_path, old_theme_path, FNLEN - 1);
+						stop = 1; 
+						break; 
+					}
+					if (event.key.keysym.sym == SDLK_RETURN) { 
+						if (loc) {
+							/* --- set theme --- */
+							SetupPaths(themePaths[loc]);
+						} else {
+							/* --- english --- */
+							SetupPaths(NULL);
+						}
+						stop = 1;
+						break;
+					}
+
+					if ((event.key.keysym.sym == SDLK_LEFT) || (event.key.keysym.sym == SDLK_PAGEUP)) {
+						if (loc-(loc%8)-8 >= 0) 
+							loc=loc-(loc%8)-8;
+					}
+
+					if ((event.key.keysym.sym == SDLK_RIGHT) || (event.key.keysym.sym == SDLK_PAGEDOWN)) {
+						if (loc-(loc%8)+8 < themes)
+							loc=(loc-(loc%8)+8);
+					}
+
+
+					if (event.key.keysym.sym == SDLK_UP) {
+						if (loc > 0)
+							loc--;
+					}
+
+					if (event.key.keysym.sym == SDLK_DOWN) {
+						if (loc+1<themes)
+							loc++;
+					}
+			}
+
+		if (old_loc != loc) {
+			int start;
+
+			SDL_BlitSurface( bkg, NULL, screen, NULL );
+
+			SDL_BlitSurface( world, NULL, screen, &worldRect );
+
+		        if (loc) SetupPaths(themePaths[loc]); else SetupPaths(NULL);
+
+			map = LoadImage( "map.png", IMG_ALPHA|IMG_NOT_REQUIRED );
+			if (map) {
+				SDL_BlitSurface( map, NULL, screen, &worldRect );
+				SDL_FreeSurface( map );
+			}
+
+			photo = LoadImage( "photo.png", IMG_ALPHA|IMG_NOT_REQUIRED );
+			if (photo) {
+				photoRect.x = 480 - (photo->w/2);
+				photoRect.y = 250;
+				photoRect.w = photo->w;
+				photoRect.h = photo->h;
+				SDL_BlitSurface( photo, NULL, screen, &photoRect );
+				SDL_FreeSurface( photo );
+			}
+
+			start = loc - (loc % 8);
+			for (i = start; i<MIN(start+8,themes); i++) {
+				titleRects[i%8].x = 160 - (titles[i]->w/2);
+				if (i == loc)
+					SDL_BlitSurface(select[loc], NULL, screen, &titleRects[i%8]);
+				else
+					SDL_BlitSurface(titles[i], NULL, screen, &titleRects[i%8]);
+			}
+
+			/* --- draw buttons --- */
+
+			if (start>0) 
+				SDL_BlitSurface( left, NULL, screen, &leftRect );
+
+			if (start+8<themes) 
+				SDL_BlitSurface( right, NULL, screen, &rightRect );
+
+			SDL_UpdateRect(screen, 0, 0, 0 ,0);
+		}
+		SDL_Delay(40);
+		old_loc = loc;
+  }
+
+  /* --- clear graphics before quitting --- */ 
+
+  for (i = 0; i<themes; i++)
+  {
+    SDL_FreeSurface(titles[i]);
+    SDL_FreeSurface(select[i]);
+  }
+
+  SDL_FreeSurface(world);
+  SDL_FreeSurface(bkg);
+  SDL_FreeSurface(left);
+  SDL_FreeSurface(right);
+  bkg = NULL;  /* the other pointers are going out of scope so we don't */
+               /* have to worry about setting them to NULL              */
+}

Added: tuxtype/branches/tuxtype-reorg/src/titlescreen.c
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/titlescreen.c	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/titlescreen.c	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,1505 @@
+/***************************************************************************
+ -  file: titlescreen.c
+ -  description: splash, title and menu screen functionality 
+                            ------------------
+    begin                : Thur May 4 2000
+    copyright            : (C) 2000 by Sam Hart
+                         : (C) 2003 by Jesse Andrews
+    email                : tuxtype-dev at tux4kids.net
+***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "globals.h"
+#include "funcs.h"
+#include "titlescreen.h"
+
+/* --- media for menus --- */
+
+/* images of regular and selected text of menu items: */
+static SDL_Surface* reg_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1] = {NULL};
+static SDL_Surface* sel_text[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1] = {NULL};
+static sprite* reg = NULL;
+static sprite* sel = NULL;
+/* this will contain pointers to all of the menu 'icons' */
+static sprite* menu_gfx[TITLE_MENU_ITEMS + 1][TITLE_MENU_DEPTH + 1] = {NULL};
+/* keep track of the width of each menu: */
+static int menu_width[TITLE_MENU_DEPTH + 1];
+
+/* NOTE for 'depth', think pages like a restaurant menu, */
+/* not heirarchical depth - choice of term is misleading */
+static int menu_depth; // how deep we are in the menu
+//int menu_sound; // status of menu sound effects
+//int menu_music; // status of menu sound effects
+
+/* --- other media --- */
+static SDL_Surface* bkg = NULL;
+static SDL_Surface* title = NULL;
+static SDL_Surface* speaker = NULL;
+static SDL_Surface* speakeroff = NULL;
+static sprite* Tux = NULL;
+static Mix_Chunk* snd_move = NULL;
+static Mix_Chunk* snd_select = NULL;
+static TTF_Font* font = NULL;
+
+/* --- locations we need --- */
+static SDL_Rect text_dst[TITLE_MENU_ITEMS + 1];     // location of text for menu
+static SDL_Rect menu_gfxdest[TITLE_MENU_ITEMS + 1]; // location of animated icon
+/* These are the rectangular mouse event "buttons" for each menu item */
+static SDL_Rect menu_button[TITLE_MENU_ITEMS + 1];  // size of "button"
+
+
+/* Local function prototypes: */
+static int chooseWordlist(void);
+static void draw_button(int id, sprite* s);
+static void not_implemented(void);
+static int load_media(void);
+static void load_menu(void);
+static void unload_media(void);
+static void unload_menu(void);
+
+/************************************************************************/
+/*                                                                      */ 
+/*         "Public" functions (callable throughout program)             */
+/*                                                                      */
+/************************************************************************/
+
+
+
+/****************************************
+* TitleScreen: Display the title screen *
+*****************************************
+* display title screen, get input
+*/
+void TitleScreen(void)
+{
+
+  SDL_Rect dest,
+	 Tuxdest,
+	 Titledest,
+	 spkrdest,
+	 cursor;
+
+  Uint32 frame = 0;
+  Uint32 start = 0;
+
+  int i, j, tux_frame = 0;
+  int done = 0;
+  int firstloop = 1;
+  int menu_opt = NONE;
+  int sub_menu = NONE;
+  int update_locs = 1;
+  int redraw = 0;
+  int key_menu = 1;
+  int old_key_menu = 5;
+  wchar_t phrase[128];
+
+
+  if (settings.sys_sound)
+  {
+    settings.menu_sound = 1;
+    settings.menu_music = 1;
+  }
+
+
+  /* FIXME phrase(s) should come from file */
+
+  ConvertFromUTF8(phrase, "Now is the time for all good men to come to the aid of their country.");
+//  ConvertFromUTF8(phrase, "To all that believe in his name he gave power to become children of God");
+
+//  wcscpy(phrase, "Now is the time for all good men to come to the aid of their country.");
+  start = SDL_GetTicks();
+
+
+  /*
+  * StandbyScreen: Display the Standby screen.... 
+  */
+
+  if (settings.show_tux4kids)
+  {
+    SDL_Surface* standby = NULL;
+    standby = LoadImage("standby.png", IMG_REGULAR|IMG_NO_THEME);
+
+    if (standby) /* Avoid segfault */
+    { 
+      dest.x = ((screen->w) / 2) - (standby->w) / 2;  // Center horizontally
+      dest.y = ((screen->h) / 2) - (standby->h) / 2;  // Center vertically
+      dest.w = standby->w;
+      dest.h = standby->h;
+
+      SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+      SDL_BlitSurface(standby, NULL, screen, &dest);
+      SDL_UpdateRect(screen, 0, 0, 0, 0);
+      SDL_FreeSurface(standby);  // Unload image
+    }
+  }
+
+
+  /* Load media and menu data: */
+  if (!load_media())
+  {
+    fprintf(stderr, "TitleScreen - load_media() failed!");
+    return;
+  }
+
+  SDL_WM_GrabInput(SDL_GRAB_ON); // User input goes to TuxType, not window manager
+
+
+  /***************************
+  * Tux and Title animations *
+  ***************************/
+
+  LOG( "->Now Animating Tux and Title onto the screen\n" );
+
+  Tuxdest.x = 0;
+  Tuxdest.y = screen->h;
+  Tuxdest.w = Tux->frame[0]->w;
+  Tuxdest.h = Tux->frame[0]->h;
+
+  Titledest.x = screen->w;
+  Titledest.y = 10;
+  Titledest.w = title->w;
+  Titledest.h = title->h;
+
+  spkrdest.x = 520;
+  spkrdest.y = 420;
+  spkrdest.w = speaker->w;
+  spkrdest.h = speaker->h;
+
+  /* --- wait if the first time in the game --- */
+
+  if (settings.show_tux4kids)
+  {
+    while ((SDL_GetTicks() - start) < 2000)
+    {
+      SDL_Delay(50);
+    }
+    settings.show_tux4kids = 0;
+  }
+
+  SDL_ShowCursor(1);    
+  /* FIXME not sure the next line works in Windows: */
+  TransWipe(bkg, RANDOM_WIPE, 10, 20);
+  /* Make sure background gets drawn (since TransWipe() doesn't */
+  /* seem to work reliably as of yet):                          */
+  SDL_BlitSurface(bkg, NULL, screen, NULL);
+  SDL_UpdateRect(screen, 0, 0, 0, 0);
+
+  /* --- Pull tux & logo onscreen --- */
+  for (i = 0; i < (PRE_ANIM_FRAMES * PRE_FRAME_MULT); i++)
+  {
+    start = SDL_GetTicks();
+    SDL_BlitSurface(bkg, &Tuxdest, screen, &Tuxdest);
+    SDL_BlitSurface(bkg, &Titledest, screen, &Titledest);
+
+    Tuxdest.y -= Tux->frame[0]->h / (PRE_ANIM_FRAMES * PRE_FRAME_MULT);
+    Titledest.x -= (screen->w) / (PRE_ANIM_FRAMES * PRE_FRAME_MULT);
+
+    SDL_BlitSurface(Tux->frame[0], NULL, screen, &Tuxdest);
+    SDL_BlitSurface(title, NULL, screen, &Titledest);
+
+    SDL_UpdateRect(screen, Tuxdest.x, Tuxdest.y, Tuxdest.w, Tuxdest.h);
+    SDL_UpdateRect(screen, Titledest.x, Titledest.y, Titledest.w+40, Titledest.h);
+
+    while ((SDL_GetTicks() - start) < 33) 
+    {
+      SDL_Delay(2);
+    }
+  }
+
+  SDL_BlitSurface(title, NULL, screen, &Titledest);
+
+  /* Pick speaker graphic according to whether music is on: */
+  if ( settings.menu_music )
+    SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
+  else
+    SDL_BlitSurface(speakeroff, NULL, screen, &spkrdest);
+
+  /* Start playing menu music if desired: */
+  if (settings.menu_music)
+    MusicLoad( "tuxi.ogg", -1 );
+
+  LOG( "Tux and Title are in place now\n" );
+
+  /* Move mouse to top button: */
+  cursor.x = menu_button[1].x + (menu_button[1].w / 2);
+  cursor.y = menu_button[1].y + (3 * menu_button[1].h / 4);
+  SDL_WarpMouse(cursor.x, cursor.y);
+  SDL_WM_GrabInput(SDL_GRAB_OFF);
+
+
+
+  /****************************
+  * Main Loop Starts Here ... *
+  ****************************/
+
+
+  menu_depth = 1;
+  firstloop = 1;
+  Tuxdest.y = screen->h - Tux->frame[0]->h;
+
+
+  while (!done) 
+  {
+
+    start=SDL_GetTicks();
+
+    /* ---process input queue --- */
+
+    menu_opt = NONE; // clear the option so we don't change twice!
+
+    old_key_menu = key_menu;
+
+    /* Retrieve any user interface events: */
+    while (SDL_PollEvent(&event))
+    {
+      switch (event.type)
+      {
+
+        case SDL_MOUSEMOTION:
+        {
+          cursor.x = event.motion.x;
+          cursor.y = event.motion.y;
+          break;
+        }
+
+
+        /* Handle mouse clicks based on mouse location: */
+        case SDL_MOUSEBUTTONDOWN:
+        {
+          cursor.x = event.motion.x;
+          cursor.y = event.motion.y;
+
+          for (j = 1; j <= TITLE_MENU_ITEMS; j++)
+          {
+            if ((cursor.x >= menu_button[j].x && cursor.x <= (menu_button[j].x + menu_button[j].w)) && 
+                (cursor.y >= menu_button[j].y && cursor.y <= (menu_button[j].y + menu_button[j].h)))
+            {
+              menu_opt = menu_item[j][menu_depth];
+              if (settings.menu_sound)
+              {
+                PlaySound(snd_select);
+              }
+              DEBUGCODE
+              {
+                fprintf(stderr, "->>BUTTON CLICK menu_opt = %d\n", menu_opt);
+                fprintf(stderr, "->J = %d menu_depth=%d\n", j, menu_depth);
+              }
+            }
+          }
+
+          /* If mouse over speaker, toggle menu music off or on: */
+          if ((cursor.x >= spkrdest.x && cursor.x <= (spkrdest.x + spkrdest.w)) && 
+              (cursor.y >= spkrdest.y && cursor.y <= (spkrdest.y + spkrdest.h)))
+          {
+            if (settings.menu_music)
+            {
+              MusicUnload();
+              settings.menu_music = 0;
+            }
+            else
+            {
+              settings.menu_music = 1;
+              MusicLoad("tuxi.ogg", -1);
+            }
+            redraw = 1;
+          }
+          break;
+        }
+
+
+
+        case SDL_QUIT:
+        {
+          menu_opt = QUIT_GAME;
+          break;
+        }
+
+
+        /* Handle key press events based on key value: */
+        case SDL_KEYDOWN:
+        {
+          switch (event.key.keysym.sym)
+          {
+            case SDLK_ESCAPE:
+            {
+              /* Go to main menu (if in submenu) or quit: */
+              if (menu_depth != 1) 
+                menu_opt = MAIN;
+              else
+                menu_opt = QUIT_GAME;
+
+              if (settings.menu_sound)
+                PlaySound(snd_select);
+              break;
+            }
+
+
+            /* Toggle screen mode: */
+            case SDLK_F10:
+            {
+              SwitchScreenMode();
+              redraw = 1;
+              break;
+            }
+
+
+            /* Toggle menu music: */
+            case SDLK_F11:
+            {
+              if (settings.menu_music)
+              {
+                MusicUnload( );
+                settings.menu_music=0;
+              }
+              else
+              {
+                settings.menu_music=1;
+                MusicLoad("tuxi.ogg", -1);
+              }
+              redraw = 1;
+              break;
+            }
+
+
+            /* --- reload translation/graphics/media: for themers/translaters --- */
+            case SDLK_F12:
+            {
+              unload_media();
+              LoadLang();
+              load_media();
+              redraw = 1;
+              break;
+            }
+
+
+            case SDLK_UP:
+            {
+              if (settings.menu_sound)
+                PlaySound(snd_move);
+              key_menu--;
+              if (key_menu < 1)
+                key_menu = 5;
+              break;
+            }
+
+
+            case SDLK_DOWN:
+            {
+              key_menu++;
+              if (settings.menu_sound)
+                PlaySound(snd_move);
+              if (key_menu > 5)
+                key_menu = 1;
+              break;
+            }
+
+
+            case SDLK_RETURN:
+            {
+              if (key_menu)
+              {
+                menu_opt = menu_item[key_menu][menu_depth];
+                if (settings.menu_sound)
+                  PlaySound(snd_select);
+              }
+              break;
+            }
+
+
+            default:     /* Some other key pressed - do nothing: */
+            {
+              break;
+            }
+          }             /* End of switch(event.key.keysym.sym) statement */
+        }               /* End of case: SDL_KEYDOWN: */
+
+
+        default:        /* Some other type of SDL event - do nothing;    */
+        {
+          break;
+        }
+      }                 /* End of switch(event.type) statement           */
+    }	              /* End of while (SDL_PollEvent(&event)) loop     */
+
+
+
+    /* --- warp mouse to follow keyboard input --- */
+
+    if (old_key_menu != key_menu)
+    {
+      cursor.x = menu_button[key_menu].x + (menu_button[key_menu].w / 2);
+      cursor.y = menu_button[key_menu].y + (3 * menu_button[key_menu].h / 4);
+      SDL_WarpMouse(cursor.x, cursor.y);
+    }
+
+
+
+    /* --- do menu processing --- */
+
+
+    if (menu_opt == QUIT_GAME)
+      done = 1;
+
+
+    if (menu_opt == LASER)
+    {
+      menu_depth = LASER_SUBMENU;
+      sub_menu = LASER;
+      update_locs = 1;
+      redraw = 1;
+    }
+
+
+    if (menu_opt == CASCADE)
+    {
+      menu_depth = CASCADE_SUBMENU;
+      sub_menu = CASCADE;
+      update_locs = 1;
+      redraw=1;
+    }
+
+
+    if (menu_opt == OPTIONS)
+    {
+      menu_depth = OPTIONS_SUBMENU;
+      sub_menu = OPTIONS;
+      update_locs = 1;
+      redraw = 1;
+    }
+
+
+    if (menu_opt == MAIN)
+    {
+      menu_depth = ROOTMENU;
+      update_locs = 1;
+      redraw = 1;
+    }
+
+
+    if (menu_opt == NOT_CODED)
+    {
+      not_implemented();
+      redraw = 1;
+    }
+
+
+    if (menu_opt == PROJECT_INFO)
+    {
+      ProjectInfo();
+      redraw = 1;
+    }
+
+
+    if (menu_opt == LESSONS)
+    {
+      SDL_BlitSurface(bkg, NULL, screen, NULL);
+      SDL_Flip( screen );
+      unload_media();
+
+      if (settings.menu_music)
+        MusicUnload( );
+
+      TestLesson();
+
+      load_media();
+      redraw = 1;
+
+      if (settings.menu_music)
+        MusicLoad( "tuxi.ogg", -1 );
+    }
+
+
+    if (menu_opt == SET_LANGUAGE)
+    {
+      unload_media();
+      ChooseTheme();
+      LoadLang();
+      LoadKeyboard();
+      load_media();
+      redraw = 1;
+
+      if (settings.menu_music)
+        MusicLoad( "tuxi.ogg", -1 );
+    }
+
+
+    if (menu_opt == LEVEL1)
+    {  
+      if (chooseWordlist()) 
+      {
+        unload_media();
+
+        switch (sub_menu)
+        {
+          case CASCADE: PlayCascade( EASY ); break;
+          case LASER:   PlayLaserGame(  EASY ); break;
+        }
+      }
+
+      load_media();
+
+      if (settings.menu_music)
+        MusicLoad("tuxi.ogg", -1);
+
+      redraw = 1;
+    }
+
+
+    if (menu_opt == LEVEL2)
+    {
+      if (chooseWordlist())
+      {
+        unload_media();
+
+        switch (sub_menu)
+        {
+          case CASCADE: PlayCascade( MEDIUM ); break;
+          case LASER:   PlayLaserGame(  MEDIUM ); break;
+        }
+
+
+        if (settings.menu_music)
+          MusicLoad( "tuxi.ogg", -1 );
+      }
+
+      load_media();
+      redraw = 1;
+    }
+
+
+
+    if (menu_opt == LEVEL3)
+    {
+      if (chooseWordlist())
+      {
+        unload_media();
+
+        switch (sub_menu)
+        {
+          case CASCADE: PlayCascade( HARD ); break;
+          case LASER:   PlayLaserGame(  HARD ); break;
+        }
+
+
+        if (settings.menu_music)
+          MusicLoad( "tuxi.ogg", -1 );
+      }
+
+      load_media();
+      redraw = 1;
+    }
+
+
+
+    if (menu_opt == LEVEL4)
+    {
+      if (chooseWordlist())
+      {
+        unload_media();
+
+        switch (sub_menu)
+        {
+          case CASCADE: PlayCascade( INSANE ); break;
+          case LASER:   PlayLaserGame(  INSANE ); break;
+        }
+
+        if (settings.menu_music)
+          MusicLoad( "tuxi.ogg", -1 );
+      }
+
+      load_media();
+      redraw = 1;
+    }
+
+
+
+    if (menu_opt == INSTRUCT)
+    {
+      unload_media();
+
+      switch (sub_menu)
+      {
+        case CASCADE: InstructCascade(); break;
+        case LASER:   InstructLaser();   break;
+      }
+
+      load_media();
+
+      if (settings.menu_music)
+        MusicLoad( "tuxi.ogg", -1 );
+
+      redraw = 1;
+    }
+
+
+
+    if (menu_opt == FREETYPE)
+    {
+      unload_media();
+      Phrases( phrase );
+      //Practice();
+      load_media();
+      redraw = 1;
+    }
+
+    /* ------ End menu_opt processing ----------- */
+
+
+
+    if (redraw)
+    {
+      LOG("TitleScreen() - redraw requested\n");
+
+      SDL_BlitSurface(bkg, NULL, screen, NULL); 
+      SDL_BlitSurface(title, NULL, screen, &Titledest);
+
+      if ( settings.menu_music )
+        SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
+      else
+        SDL_BlitSurface(speakeroff, NULL, screen, &spkrdest);
+
+      /* Screen will be updated due to update_locs - see ~30 lines down: */
+//      SDL_UpdateRect(screen, 0, 0, 0, 0);
+      frame = redraw = 0;   // so we redraw tux
+      update_locs = 1;      // so we redraw menu
+      firstloop = 1;
+    }
+
+
+
+    /* --- create new menu screen when needed --- */
+
+    if (update_locs)
+    {
+      LOG("TitleScreen() - update_locs requested\n");
+
+      /* --- erase the last menu --- */
+      for (i = 1; i <= TITLE_MENU_ITEMS; i++)
+      {
+        text_dst[i].x = 290;
+        text_dst[i].w = reg_text[i][menu_depth]->w;
+        text_dst[i].h = reg_text[i][menu_depth]->h;
+        SDL_BlitSurface(bkg, &menu_button[i], screen, &menu_button[i]);
+        menu_button[i].w = menu_width[menu_depth] + (2*reg->frame[2]->w);
+      }
+
+
+      update_locs = 0;
+
+      /* --- draw the full menu --- */
+
+      for (j = 1; j <= TITLE_MENU_ITEMS; j++)
+      {
+        DOUT(j);
+        draw_button(j, reg);
+        if (reg_text[j][menu_depth] != NULL)
+          SDL_BlitSurface(reg_text[j][menu_depth], NULL, screen, &text_dst[j]);
+        if (menu_gfx[j][menu_depth] != NULL)
+          SDL_BlitSurface(menu_gfx[j][menu_depth]->default_img, NULL, screen, &menu_gfxdest[j]);
+      }
+
+      SDL_UpdateRect(screen, 0, 0, 0, 0);
+
+      LOG("TitleScreen() - update_locs completed\n");
+    }
+
+
+
+    /* --- make tux blink --- */
+
+    switch (frame % TUX6)
+    {
+      case 0:    tux_frame = 1; break;
+      case TUX1: tux_frame = 2; break;
+      case TUX2: tux_frame = 3; break;
+      case TUX3: tux_frame = 4; break;			
+      case TUX4: tux_frame = 3; break;
+      case TUX5: tux_frame = 2; break;
+      default: tux_frame = 0;
+    }
+
+    if (tux_frame)
+    {
+      SDL_BlitSurface(bkg, &Tuxdest, screen, &Tuxdest);
+      SDL_BlitSurface(Tux->frame[tux_frame - 1], NULL, screen, &Tuxdest);
+    }
+
+
+    /* --- check if mouse is in a menu option --- */
+
+    key_menu = 0;
+
+    for (j = 1; j <= TITLE_MENU_ITEMS; j++)
+    {
+      if ((cursor.x >= menu_button[j].x && cursor.x <= (menu_button[j].x + menu_button[j].w)) &&
+          (cursor.y >= menu_button[j].y && cursor.y <= (menu_button[j].y + menu_button[j].h)))
+      {
+        key_menu = j; // update menu to point
+        break;        // Don't need to check rest of menu
+      }
+    }
+
+
+    /* --- return old selection to unselected state --- */
+
+    if (old_key_menu && (key_menu != old_key_menu))
+    {
+      SDL_BlitSurface(bkg, &menu_button[old_key_menu], screen, &menu_button[old_key_menu]);
+      draw_button( old_key_menu, reg );
+      SDL_BlitSurface(reg_text[old_key_menu][menu_depth], NULL, screen, &text_dst[old_key_menu]);
+      SDL_BlitSurface(menu_gfx[old_key_menu][menu_depth]->default_img, NULL, screen, &menu_gfxdest[old_key_menu]);
+    }
+
+
+    /* --- draw current selection --- */
+
+    if ((key_menu != 0) &&
+       ((old_key_menu != key_menu) || (frame % 5 == 0))) // Redraw every fifth frame?
+    {
+      if (key_menu != old_key_menu)
+      {
+        REWIND(menu_gfx[key_menu][menu_depth]);
+        PlaySound(snd_move);
+      }
+
+      SDL_BlitSurface(bkg, &menu_button[key_menu], screen, &menu_button[key_menu]);
+      draw_button( key_menu, sel );
+      SDL_BlitSurface(sel_text[key_menu][menu_depth], NULL, screen, &text_dst[key_menu]);
+      SDL_BlitSurface(menu_gfx[key_menu][menu_depth]->frame[menu_gfx[key_menu][menu_depth]->cur], NULL, screen, &menu_gfxdest[key_menu]);
+
+      NEXT_FRAME(menu_gfx[key_menu][menu_depth]);
+    }
+
+
+    // HACK This is still more than we need to update every frame but
+    // it cuts cpu on my machine %60 so it seems better...
+    if ( settings.menu_music )
+      SDL_BlitSurface(speaker, NULL, screen, &spkrdest);
+    else
+      SDL_BlitSurface(speakeroff, NULL, screen, &spkrdest);
+
+    SDL_UpdateRect(screen, spkrdest.x, spkrdest.y, spkrdest.w, spkrdest.h);
+
+    for ( i=1; i<6; i++ )
+    {
+      SDL_UpdateRect(screen, menu_button[i].x, menu_button[i].y, menu_button[i].w, menu_button[i].h);
+    }
+
+    if (tux_frame)
+      SDL_UpdateRect(screen, Tuxdest.x, Tuxdest.y, Tuxdest.w, Tuxdest.h);
+
+    if (firstloop)
+      SDL_UpdateRect(screen, Tuxdest.x, Tuxdest.y, Tuxdest.w, Tuxdest.h);
+
+    firstloop = 0;
+
+    /* Wait so we keep frame rate constant: */
+    while ((SDL_GetTicks() - start) < 33)
+    {
+      SDL_Delay(20);
+    }
+
+    frame++;
+  } /* ----------- End of 'while(!done)' loop ------------  */
+
+
+
+  LOG( "->>Freeing title screen images\n" );
+
+  unload_media();
+
+  LOG( "->TitleScreen():END \n" );
+}
+
+
+void SwitchScreenMode(void)
+{
+  SDL_Surface *tmp;
+  SDL_Rect src, dst;
+  int window=0;
+  src.x = 0; src.y = 0;
+  src.w = RES_X; src.h = RES_Y;
+  dst.x = 0; dst.y = 0;
+
+  tmp = SDL_CreateRGBSurface(
+      SDL_SWSURFACE,
+      RES_X,
+      RES_Y,
+      BPP,
+#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+      0xff000000,
+      0x00ff0000,
+      0x0000ff00,
+      0x000000ff
+#else
+      0x000000ff,
+      0x0000ff00,
+      0x00ff0000,
+      0xff000000
+#endif
+      );
+  if (screen->flags & SDL_FULLSCREEN)
+	window=1;
+  SDL_BlitSurface(screen,&src,tmp,&dst);
+  SDL_UpdateRect(tmp,0,0,RES_X,RES_Y);
+  SDL_FreeSurface(screen);
+  screen = NULL;
+
+  if ( window ){
+	screen = SDL_SetVideoMode(RES_X,RES_Y,BPP, SDL_SWSURFACE|SDL_HWPALETTE);
+  } else {
+	screen = SDL_SetVideoMode(RES_X,RES_Y,BPP, SDL_SWSURFACE|SDL_HWPALETTE|SDL_FULLSCREEN);
+  }
+  SDL_BlitSurface(tmp,&src,screen,&dst);
+  SDL_UpdateRect(tmp,0,0,RES_X,RES_Y);
+  SDL_FreeSurface(tmp);
+
+  /* FIXME maybe settings.fullscreen should be updated by the */
+  /* calling function rather than here? */
+  settings.fullscreen = !settings.fullscreen;
+}
+
+
+/************************************************************************/
+/*                                                                      */ 
+/*       "Private" functions (local to titlescreen.c)                   */
+/*                                                                      */
+/************************************************************************/
+
+
+static void draw_button(int id, sprite* s) {
+	SDL_Rect button;
+
+	button.x = menu_button[id].x;
+	button.y = menu_button[id].y;
+	button.w = s->frame[0]->w;
+	button.h = s->frame[0]->h;
+	SDL_BlitSurface(s->frame[0], NULL, screen, &button);
+	button.w = s->frame[1]->w;
+	for (button.x += s->frame[0]->w; button.x < (menu_button[id].x + menu_width[menu_depth]); button.x += s->frame[1]->w) 
+		SDL_BlitSurface(s->frame[1], NULL, screen, &button);
+	button.w = s->frame[2]->w;
+	SDL_BlitSurface(s->frame[2], NULL, screen, &button);
+}
+
+static void load_menu(void)
+{
+  unsigned char fn[FNLEN];
+  int max, i, j;
+
+  SDL_ShowCursor(1);
+
+  LOG("loading & parsing menu\n");
+
+  for (j = 1; j <= TITLE_MENU_DEPTH; j++)  /* Each 'depth' is a different menu */
+  {
+    max = 0;
+    for (i = 1; i <= TITLE_MENU_ITEMS; i++)
+    {
+      DEBUGCODE
+      {
+        fprintf(stderr, "i = '%d'\tj = '%d'\ttext = '%s'\n",
+                i, j,  _((unsigned char*)menu_text[i][j]));
+      }
+
+      /* --- create text surfaces --- */
+      reg_text[i][j] = BlackOutline( _((unsigned char*)menu_text[i][j]), font, &white);
+      sel_text[i][j] = BlackOutline( _((unsigned char*)menu_text[i][j]), font, &yellow);
+
+      /* (first make sure ptr valid to avoid segfault) */
+      if (sel_text[i][j] && sel_text[i][j]->w > max)
+        max = sel_text[i][j]->w;
+
+      /* --- load animated icon for menu item --- */
+      sprintf(fn, "menu/%s", menu_icon[i][j]);
+      menu_gfx[i][j] = LoadSprite(fn, IMG_ALPHA);
+    }
+    menu_width[j] = max + 20 + 40; // Not clear where '20' and '40' are coming from
+  }
+
+  LOG("done creating graphics, now setting positions\n");
+
+  /* --- setup menu item destinations --- */
+  menu_button[1].x = 240;
+  menu_button[1].y = 100;
+  menu_button[1].w = menu_width[1];  //calc from width of widest menu item
+  /* we should only get to here after we know 'sel' successfully loaded, so safe: */
+  menu_button[1].h = sel->frame[1]->h; //height of sprite image
+
+  menu_gfxdest[1].x = menu_button[1].x + 6; // inset graphic by (6, 4) */
+  menu_gfxdest[1].y = menu_button[1].y + 4;
+  menu_gfxdest[1].w = 40;
+  menu_gfxdest[1].h = 50;
+
+  text_dst[1].y = menu_button[1].y + 15;
+
+  /* FIXME each menu item drawn hardcoded 60 pixels below last - */
+  /* perhaps increment should be "menu_button[j-1].h + MENU_ITEM_GAP" */
+  for (j = 2; j < 6; j++) 
+  {
+    /* --- setup vertical location of button text --- */
+    text_dst[j].y = text_dst[j-1].y + 60;
+
+    /* --- setup location of button background --- */
+    menu_button[j].x = menu_button[j-1].x;
+    menu_button[j].y = menu_button[j-1].y + 60;
+    menu_button[j].w = menu_button[j-1].w;
+    menu_button[j].h = menu_button[j-1].h;
+
+    /* --- setup location of animated icon --- */
+    menu_gfxdest[j].x = menu_gfxdest[j-1].x;
+    menu_gfxdest[j].y = menu_gfxdest[j-1].y + 60;
+    menu_gfxdest[j].w = menu_gfxdest[j-1].w;
+    menu_gfxdest[j].h = menu_gfxdest[j-1].h;
+  }
+}
+
+
+static void unload_menu(void)
+{
+  int i,j;
+  printf("enter unload_menu()\n");
+
+  for (i = 1; i <= TITLE_MENU_ITEMS; i++)
+  {
+    for (j = 1; j <= TITLE_MENU_DEPTH; j++)
+    {
+      if (reg_text[i][j])
+        SDL_FreeSurface(reg_text[i][j]);
+      if (sel_text[i][j])
+        SDL_FreeSurface(sel_text[i][j]);
+      if (menu_gfx[i][j])
+        FreeSprite(menu_gfx[i][j]);
+      reg_text[i][j] = sel_text[i][j] = NULL;
+      menu_gfx[i][j] = NULL;
+    }
+  }
+}
+
+
+static int load_media(void)
+{
+  DEBUGCODE
+  {
+    fprintf(stderr, "Entering load_media():\n");
+    fprintf(stderr, "default_data_path = %s\n", settings.default_data_path);
+    fprintf(stderr, "theme_data_path = %s\n", settings.theme_data_path);
+  }
+
+  /* Make sure everything is unloaded before we start: */
+  /* FIXME have not been to do this to run without crashing: */
+  //unload_media();
+
+  /* --- load sounds --- */
+  if (settings.menu_sound)
+  {
+    snd_move = LoadSound("tock.wav");
+    snd_select = LoadSound("pop.wav");
+    if (!snd_move || !snd_select)
+    {
+      fprintf(stderr, "Could not load menu sounds - turning menu_sound off\n");
+      settings.menu_sound = 0;
+    }
+  }
+ 
+  /* --- load graphics --- */
+  title = LoadImage( "title1.png", IMG_ALPHA );
+  speaker = LoadImage( "sound.png", IMG_ALPHA );
+  speakeroff = LoadImage( "nosound.png", IMG_ALPHA );
+  bkg = LoadImage( "main_bkg.png", IMG_REGULAR );
+  sel = LoadSprite("menu/sel", IMG_ALPHA);
+  reg = LoadSprite("menu/reg", IMG_ALPHA);
+  Tux = LoadSprite("tux", IMG_ALPHA);
+
+  DEBUGCODE
+  {
+    fprintf(stderr, "titlescreen.c load_media(): settings.theme_font_name is %s\n",
+            settings.theme_font_name);
+  }
+  font = LoadFont(settings.theme_font_name, MENU_FONT_SIZE);
+
+  /* Make sure we were successful: */
+  if (!title
+   || !speaker
+   || !speakeroff
+   || !bkg
+   || !sel
+   || !reg
+   || !Tux
+   || !font)
+  {
+    fprintf(stderr, "load_media() - could not load all needed files\n");
+    unload_media();
+    return 0;
+  }
+
+  /* Should probably call this directly from TitleScreen() */
+  load_menu();
+  return 1;
+}
+
+
+
+static void unload_media(void)
+{
+  LOG("Entering unload_media():\n");
+
+  /* --- unload sounds --- */
+  if (settings.menu_sound){
+ 
+    if (snd_move)
+    { 
+      Mix_FreeChunk(snd_move);
+      snd_move = NULL;
+    }
+    if (snd_select)
+    { 
+      Mix_FreeChunk(snd_select);
+      snd_select = NULL;
+    }
+  }
+
+  /* --- unload graphics --- */
+  if (title)
+  {
+    SDL_FreeSurface(title);
+    title = NULL;
+  }
+  if (speaker)
+  {
+    SDL_FreeSurface(speaker);
+    speaker = NULL;
+  }
+  if (speakeroff)
+  {
+    SDL_FreeSurface(speakeroff);
+    speakeroff = NULL;
+  }
+
+  if (bkg)
+  {
+    SDL_FreeSurface(bkg);
+    bkg = NULL;
+  }
+
+  if (sel)
+  {
+    FreeSprite(sel);
+    sel = NULL;
+  }
+  if (reg)
+  {
+    FreeSprite(reg);
+    reg = NULL;
+  }
+  if (Tux)
+  {
+    FreeSprite(Tux);
+    Tux = NULL;
+  }
+
+  if (font)
+  {
+    TTF_CloseFont(font);
+    font = NULL;
+  }
+
+  LOG("Leaving load_media():\n");
+
+  unload_menu();
+}
+
+
+static void not_implemented(void)
+{
+  SDL_Surface* bk = NULL;
+  SDL_Surface *s1 = NULL, *s2 = NULL, *s3 = NULL, *s4 = NULL;
+  sprite* tux = NULL;
+  SDL_Rect loc;
+  int finished = 0, i;
+
+  LOG( "NotImplemented() - creating text\n" );
+
+  s1 = BlackOutline( _("Work In Progress!"), font, &white);
+  s2 = BlackOutline( _("This feature is not ready yet"), font, &white);
+  s3 = BlackOutline( _("Discuss the future of TuxTyping at"), font, &white);
+
+  /* we always want the URL in english */
+  /* NOTE: all fonts are almost certain to include glyphs for ASCII, */
+  /* so the following "english_font" hackery is probably unnecessary: */
+  if (!settings.use_english)
+  {
+    TTF_Font *english_font;
+    settings.use_english = 1;
+    english_font = LoadFont(DEFAULT_MENU_FONT, MENU_FONT_SIZE);
+    s4 = BlackOutline( "http://tuxtype.sf.net/forums", english_font, &white);
+    TTF_CloseFont(english_font);
+    settings.use_english = 0;
+  }
+  else 
+    s4 = BlackOutline( "http://tuxtype.sf.net/forums", font, &white);
+
+  tux = LoadSprite("tux/tux-egypt", IMG_ALPHA);
+  bk = LoadImage("main_bkg.png", IMG_REGULAR);
+
+  if (s1 && s2 && s3 && s4 && tux && bk)
+  {
+    LOG( "NotImplemented() - drawing screen\n" );
+
+    SDL_BlitSurface(bk, NULL, screen, NULL);
+    loc.x = 320-(s1->w/2); loc.y = 10;
+    SDL_BlitSurface( s1, NULL, screen, &loc);
+    loc.x = 320-(s2->w/2); loc.y = 60;
+    SDL_BlitSurface( s2, NULL, screen, &loc);
+    loc.x = 320-(s3->w/2); loc.y = 400;
+    SDL_BlitSurface( s3, NULL, screen, &loc);
+    loc.x = 320-(s4->w/2); loc.y = 440;
+    SDL_BlitSurface( s4, NULL, screen, &loc);
+
+    loc.x = 320-(tux->frame[0]->w/2);
+    loc.y = 200;
+    loc.w = tux->frame[0]->w;
+    loc.h = tux->frame[0]->h;
+    SDL_BlitSurface( tux->frame[tux->cur], NULL, screen, &loc);
+
+    SDL_UpdateRect(screen, 0, 0, 0, 0);
+
+    i = 0;
+
+    while (!finished)
+    {
+      while (SDL_PollEvent(&event)) 
+      {
+        switch (event.type)
+        {
+          case SDL_QUIT:
+            exit(0);
+          case SDL_MOUSEBUTTONDOWN:
+          case SDL_KEYDOWN:
+            finished = 1;
+        }
+      }
+
+      i++;
+
+      if (i %5 == 0)
+      {
+        NEXT_FRAME(tux);
+        SDL_BlitSurface(bk, &loc, screen, &loc);
+        SDL_BlitSurface(tux->frame[tux->cur], NULL, screen, &loc);
+        SDL_UpdateRect(screen, loc.x, loc.y, loc.w, loc.h);
+      }
+
+      SDL_Delay(40);
+    }
+  }
+  else
+    fprintf(stderr, "NotImplemented() - could not load needed graphic\n");
+
+  SDL_FreeSurface(s1);
+  SDL_FreeSurface(s2);
+  SDL_FreeSurface(s3);
+  SDL_FreeSurface(s4);
+  SDL_FreeSurface(bk);
+  s1 = s2 = s3 = s4 = bk = NULL;
+  FreeSprite(tux);
+  tux = NULL;
+}
+
+
+
+
+#define MAX_WORD_LISTS 100
+
+/* returns 0 if user pressed escape ...
+ *         1 if word list was set correctly
+ */
+static int chooseWordlist(void)
+{
+  SDL_Surface* titles[MAX_WORD_LISTS] = {NULL};
+  SDL_Surface* select[MAX_WORD_LISTS] = {NULL};
+  SDL_Surface* left = NULL, *right = NULL;
+  SDL_Surface* backg = NULL;
+  SDL_Rect leftRect, rightRect;
+  SDL_Rect titleRects[8];
+  int stop = 0;
+  int loc = 0;
+  int old_loc = 1;
+  int lists = 0;
+  int i;
+  unsigned char wordPath[FNLEN];
+  unsigned char wordlistFile[MAX_WORD_LISTS][200];
+  unsigned char wordlistName[MAX_WORD_LISTS][200];
+
+  DIR* wordsDir = NULL;
+  struct dirent* wordsFile = NULL;
+  FILE* tempFile = NULL;
+
+  LOG("Entering chooseWordlist():\n");
+
+  /* find the directory to load wordlists from */
+
+  /* Check under theme directory first, if theme selected: */
+  if (!settings.use_english)  /* Using theme: */
+  {
+    sprintf(wordPath,"%s/words", settings.theme_data_path);
+    if (!CheckFile(wordPath))
+    {
+      fprintf(stderr, "chooseWordList() - theme contains no wordlist dir \n");
+      return 0;
+    }
+  }
+  else  /* No theme selected - using English: */
+  {
+    sprintf(wordPath,"%s/words", settings.default_data_path);
+    if (!CheckFile(wordPath))
+    {
+      fprintf(stderr, "chooseWordList() - data path contains no wordlist dir \n");
+      return 0;
+    }
+  }
+
+  /* If we get to here, we know there is at least a wordlist directory */
+  /* but not necessarily any valid files.                              */
+
+  DEBUGCODE { fprintf(stderr, "wordPath is: %s\n", wordPath); }
+
+
+  /* FIXME looks like a place for scandir() - or our own w32_scandir() */
+  /* create a list of all the .txt files */
+
+  wordsDir = opendir( wordPath );	
+
+  do
+  {
+    wordsFile = readdir(wordsDir);
+    if (!wordsFile)
+      break; /* Loop continues until break occurs */
+
+    /* must have at least .txt at the end */
+    if (strlen(wordsFile->d_name) < 5)
+      continue;
+
+    if (strcmp(&wordsFile->d_name[strlen(wordsFile->d_name)-4],".txt"))
+      continue;
+
+    sprintf(wordlistFile[lists], "%s/%s", wordPath, wordsFile->d_name);
+
+    /* load the name for the wordlist from the file ... (1st line) */
+    tempFile = fopen( wordlistFile[lists], "r" );
+    if (!tempFile)
+      continue;
+
+    fscanf(tempFile, "%[^\n]\n", wordlistName[lists]);
+
+    /* check to see if it has a \r at the end of it (dos format!) */
+    if (wordlistName[lists][strlen(wordlistName[lists]) - 1] == '\r')
+      wordlistName[lists][strlen(wordlistName[lists]) - 1] = '\0';
+
+    lists++;
+
+    fclose(tempFile);
+  } while (1); /* Loop continues until break occurs */
+
+  closedir(wordsDir);	
+ 
+ DEBUGCODE { fprintf(stderr, "Found %d .txt file(s) in words dir\n", lists); }
+
+
+
+  /* let the user pick the list */
+
+  /* Render SDL_Surfaces for list entries: */
+//  titles[0] = BlackOutline( _("Alphabet"), font, &white );
+//  select[0] = BlackOutline( _("Alphabet"), font, &yellow);
+
+  /* NOTE - no longer hard-coding titles[0] to be alphabet - themes  */
+  /* should include a regular word list file called "alphabet.txt"   */
+  /* Should sort the list and always put the alphabet file first, if */
+  /* present.                                                        */
+  for (i = 0; i < lists; i++)
+  {
+    titles[i] = BlackOutline( wordlistName[i], font, &white );
+    select[i] = BlackOutline( wordlistName[i], font, &yellow);
+  }
+
+  backg = LoadImage("main_bkg.png", IMG_REGULAR);
+  left = LoadImage("left.png", IMG_ALPHA);
+  right = LoadImage("right.png", IMG_ALPHA);
+
+  /* Get out if needed surface not loaded successfully: */
+  if (!backg || !left || !right)
+  {
+    fprintf(stderr, "chooseWordList(): needed image not available\n");
+  
+    for (i = 0; i < lists; i++)
+    {
+      SDL_FreeSurface(titles[i]);
+      SDL_FreeSurface(select[i]);
+      titles[i] = select[i] = NULL;
+    }
+
+    SDL_FreeSurface(backg);
+    SDL_FreeSurface(left);
+    SDL_FreeSurface(right);
+    backg = left = right = NULL;
+
+    return 0;
+  }
+  
+
+
+  leftRect.w = left->w; leftRect.h = left->h;
+  leftRect.x = 320 - 80 - (leftRect.w/2); leftRect.y = 430;
+
+  rightRect.w = right->w; rightRect.h = right->h;
+  rightRect.x = 320 + 80 - (rightRect.w/2); rightRect.y = 430;
+
+  /* set initial rect sizes */
+  titleRects[0].y = 30;
+  titleRects[0].w = titleRects[0].h = titleRects[0].x = 0;
+
+  for (i = 1; i < 8; i++)
+  { 
+    titleRects[i].y = titleRects[i - 1].y + 50;
+    titleRects[i].w = titleRects[i].h = titleRects[i].x = 0;
+  }
+
+  /* Main event loop for this screen: */
+  while (!stop)
+  {
+    while (SDL_PollEvent(&event))
+    {
+      switch (event.type)
+      {
+        case SDL_QUIT:
+          exit(0); /* FIXME may need to cleanup memory and exit more cleanly */
+          break;
+
+        case SDL_MOUSEMOTION:
+          for (i=0; (i<8) && (loc-(loc%8)+i<lists); i++)
+            if (inRect( titleRects[i], event.motion.x, event.motion.y ))
+            {
+              loc = loc-(loc%8)+i;
+              break;
+            }
+          break;
+
+        case SDL_MOUSEBUTTONDOWN:
+                                        if (inRect( leftRect, event.button.x, event.button.y ))
+                                                if (loc-(loc%8)-8 >= 0) {
+                                                        loc=loc-(loc%8)-8;
+                                                        break;
+                                                }
+                                        if (inRect( rightRect, event.button.x, event.button.y ))
+                                                if (loc-(loc%8)+8 < lists) {
+                                                        loc=loc-(loc%8)+8;
+                                                        break;
+                                                }
+                                        for (i=0; (i<8) && (loc-(loc%8)+i<lists); i++)
+                                                if (inRect(titleRects[i], event.button.x, event.button.y)) {
+                                                        loc = loc-(loc%8)+i;
+							ClearWordList(); /* clear old selection */
+							//if (loc==0)
+							//  UseAlphabet(); 
+							//else
+							GenerateWordList(wordlistFile[loc]); 
+                                                        stop = 1;
+                                                        break;
+                                                }
+                                        break;
+                                case SDL_KEYDOWN:
+                                        if (event.key.keysym.sym == SDLK_ESCAPE) { stop = 2; break; }
+                                        if (event.key.keysym.sym == SDLK_RETURN) {
+						ClearWordList(); /* clear old selection */
+						//if (loc==0)
+						//  UseAlphabet(); 
+						//else
+						GenerateWordList(wordlistFile[loc]); 
+                                                stop = 1;
+                                                break;
+                                        }
+
+                                        if ((event.key.keysym.sym == SDLK_LEFT) || (event.key.keysym.sym == SDLK_PAGEUP)) {
+                                                if (loc-(loc%8)-8 >= 0)
+                                                        loc=loc-(loc%8)-8;
+                                        }
+
+                                        if ((event.key.keysym.sym == SDLK_RIGHT) || (event.key.keysym.sym == SDLK_PAGEDOWN)) {
+                                                if (loc-(loc%8)+8 < lists)
+                                                        loc=(loc-(loc%8)+8);
+                                        }
+
+                                        if (event.key.keysym.sym == SDLK_UP) {
+                                                if (loc > 0)
+                                                        loc--;
+                                        }
+
+                                        if (event.key.keysym.sym == SDLK_DOWN) {
+                                                if (loc+1<lists)
+                                                        loc++;
+                                        }
+      }
+    }
+
+    if (old_loc != loc) {
+                        int start;
+
+                        SDL_BlitSurface(backg, NULL, screen, NULL );
+
+                        start = loc - (loc % 8);
+                        for (i = start; i<MIN(start+8,lists); i++) {
+                                titleRects[i%8].x = 320 - (titles[i]->w/2);
+                                if (i == loc)
+                                        SDL_BlitSurface(select[loc], NULL, screen, &titleRects[i%8]);
+                                else
+                                        SDL_BlitSurface(titles[i], NULL, screen, &titleRects[i%8]);
+                        }
+
+                        /* --- draw buttons --- */
+
+                        if (start>0)
+                                SDL_BlitSurface( left, NULL, screen, &leftRect );
+
+                        if (start+8<lists)
+                                SDL_BlitSurface( right, NULL, screen, &rightRect );
+
+                        SDL_UpdateRect(screen, 0, 0, 0 ,0);
+                }
+                SDL_Delay(40);
+                old_loc = loc;
+  }
+
+  /* --- clear graphics before leaving function --- */ 
+  for (i = 0; i<lists; i++)
+  {
+    SDL_FreeSurface(titles[i]);
+    SDL_FreeSurface(select[i]);
+    titles[i] = select[i] = NULL;
+  }
+
+  SDL_FreeSurface(backg);
+  SDL_FreeSurface(left);
+  SDL_FreeSurface(right);
+  backg = left = right = NULL; /* Maybe overkill - about to be destroyed anyway */
+
+  DEBUGCODE { fprintf( stderr, "Leaving chooseWordlist();\n" ); }
+
+  if (stop == 2)
+    return 0;
+
+  return 1;
+}
+
+
+
+
+

Added: tuxtype/branches/tuxtype-reorg/src/titlescreen.h
===================================================================
--- tuxtype/branches/tuxtype-reorg/src/titlescreen.h	                        (rev 0)
+++ tuxtype/branches/tuxtype-reorg/src/titlescreen.h	2008-03-26 11:29:18 UTC (rev 442)
@@ -0,0 +1,45 @@
+
+/* --- SETUP MENU OPTIONS --- */
+
+#define TITLE_MENU_ITEMS                5
+#define TITLE_MENU_DEPTH                4
+
+#define OPTIONS_SUBMENU                 4
+#define LASER_SUBMENU	        	3
+#define CASCADE_SUBMENU	        	2
+#define ROOTMENU		        1
+
+/* --- define menu structure --- */
+/* (these values are all in the Game_Type enum in globals.h) */
+const int menu_item[][6]= {{0, 0,         0,         0,          0},
+			   {0, CASCADE,   LEVEL1,    LEVEL1,  NOT_CODED },
+			   {0, LASER,     LEVEL2,    LEVEL2,  FREETYPE   },
+			   {0, LESSONS,  LEVEL3,    LEVEL3,  PROJECT_INFO },
+			   {0, OPTIONS,   INSTRUCT,  LEVEL4,  SET_LANGUAGE},
+			   {0, QUIT_GAME, MAIN,      MAIN,    MAIN}};
+
+/* --- menu text --- */
+const unsigned char *menu_text[][6]= 
+{{"", "",            "",             "",            ""    },
+ {"", gettext_noop("Fish Cascade"), gettext_noop("Easy"),         gettext_noop("Space Cadet"), gettext_noop("Edit Word Lists")},
+ {"", gettext_noop("Comet Zap"),    gettext_noop("Medium"),       gettext_noop("Pilot"),       gettext_noop("Practice")},
+ {"", gettext_noop("Lessons"),     gettext_noop("Hard"),         gettext_noop("Ace"),         gettext_noop("Project Info")},
+ {"", gettext_noop("Options"),      gettext_noop("Instructions"), gettext_noop("Commander"),   gettext_noop("Setup Language")},
+ {"", gettext_noop("Quit"),         gettext_noop("Main Menu"),    gettext_noop("Main Menu"),   gettext_noop("Main Menu")}};
+
+/* --- menu icons --- */
+const unsigned char *menu_icon[][6]= 
+{{"", "", "", "", ""},
+ {"", "cascade", "easy",   "grade1_", "list"   },
+ {"", "comet",   "medium", "grade2_", "practice" },
+ {"", "lesson","hard",   "grade3_", "keyboard"   },
+ {"", "tux_config",  "tutor",  "grade4_", "lang" },
+ {"", "quit",    "main",   "main",    "main"   }};
+
+/* --- timings for tux blinking --- */
+#define TUX1                            115
+#define TUX2                            118
+#define TUX3                            121
+#define TUX4                            124
+#define TUX5                            127
+#define TUX6                            130




More information about the Tux4kids-commits mailing list