]> git.jsancho.org Git - gacela.git/commitdiff
Gacela as Guile modules.
authorjsancho <devnull@localhost>
Fri, 2 Dec 2011 19:24:52 +0000 (19:24 +0000)
committerjsancho <devnull@localhost>
Fri, 2 Dec 2011 19:24:52 +0000 (19:24 +0000)
configure
src/gacela_SDL.c [deleted file]
src/gacela_SDL.h [deleted file]
src/sdl.c [new file with mode: 0644]
src/sdl.scm [new file with mode: 0644]

index 9eea52f9bc975bba71bed75dd9de40e084b874c6..c6644007aec7de4853df72bf69da6b511dbdbe0e 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for gacela 0.5.
+# Generated by GNU Autoconf 2.68 for gacela 0.5.
 #
 # Report bugs to <jsf@jsancho.org>.
 #
@@ -91,6 +91,7 @@ fi
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -215,11 +216,18 @@ IFS=$as_save_IFS
   # We cannot yet assume a decent shell, so we have to provide a
        # neutralization value for shells without unset; and this also
        # works around shells that cannot unset nonexistent variables.
+       # Preserve -v and -x to the replacement shell.
        BASH_ENV=/dev/null
        ENV=/dev/null
        (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
        export CONFIG_SHELL
-       exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+       case $- in # ((((
+         *v*x* | *x*v* ) as_opts=-vx ;;
+         *v* ) as_opts=-v ;;
+         *x* ) as_opts=-x ;;
+         * ) as_opts= ;;
+       esac
+       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
 fi
 
     if test x$as_have_required = xno; then :
@@ -1060,7 +1068,7 @@ Try \`$0 --help' for more information"
     $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1351,7 +1359,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 gacela configure 0.5
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1397,7 +1405,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
        ac_retval=1
 fi
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_compile
@@ -1443,7 +1451,7 @@ fi
   # interfere with the next link command; also delete a directory that is
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
   as_fn_set_status $ac_retval
 
 } # ac_fn_c_try_link
@@ -1452,7 +1460,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by gacela $as_me 0.5, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -1710,7 +1718,7 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
       || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
   fi
 done
 
@@ -1847,7 +1855,7 @@ ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -1934,11 +1942,11 @@ am_lf='
 '
 case `pwd` in
   *[\\\"\#\$\&\'\`$am_lf]*)
-    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
 esac
 case $srcdir in
   *[\\\"\#\$\&\'\`$am_lf\ \    ]*)
-    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
 esac
 
 # Do `set' in a subshell so we don't clobber the current shell's
@@ -2024,7 +2032,7 @@ if test "$cross_compiling" != no; then
 set dummy ${ac_tool_prefix}strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
+if ${ac_cv_prog_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
@@ -2064,7 +2072,7 @@ if test -z "$ac_cv_prog_STRIP"; then
 set dummy strip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
@@ -2117,7 +2125,7 @@ INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
 if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then :
+  if ${ac_cv_path_mkdir+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -2168,7 +2176,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
+if ${ac_cv_prog_AWK+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$AWK"; then
@@ -2208,7 +2216,7 @@ done
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -2316,7 +2324,7 @@ if test -n "$ac_tool_prefix"; then
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2356,7 +2364,7 @@ if test -z "$ac_cv_prog_CC"; then
 set dummy gcc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2409,7 +2417,7 @@ if test -z "$CC"; then
 set dummy ${ac_tool_prefix}cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2449,7 +2457,7 @@ if test -z "$CC"; then
 set dummy cc; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2508,7 +2516,7 @@ if test -z "$CC"; then
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2552,7 +2560,7 @@ do
 set dummy $ac_prog; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2607,7 +2615,7 @@ fi
 test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 
 # Provide some information about the compiler.
 $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
@@ -2722,7 +2730,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
@@ -2765,7 +2773,7 @@ else
   { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
@@ -2824,7 +2832,7 @@ $as_echo "$ac_try_echo"; } >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot run C compiled programs.
 If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
     fi
   fi
 fi
@@ -2835,7 +2843,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
 ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2876,7 +2884,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5 ; }
+See \`config.log' for more details" "$LINENO" 5; }
 fi
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
@@ -2886,7 +2894,7 @@ OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2923,7 +2931,7 @@ ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
@@ -3001,7 +3009,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
@@ -3162,7 +3170,7 @@ depcc="$CC"   am_compiler_list=
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
 $as_echo_n "checking dependency style of $depcc... " >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
@@ -3289,7 +3297,7 @@ fi
 set dummy guile; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GUILE+set}" = set; then :
+if ${ac_cv_path_GUILE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $GUILE in
@@ -3333,7 +3341,7 @@ fi
 set dummy guile-config; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GUILE_CONFIG+set}" = set; then :
+if ${ac_cv_path_GUILE_CONFIG+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $GUILE_CONFIG in
@@ -3377,7 +3385,7 @@ fi
 set dummy guile-tools; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GUILE_TOOLS+set}" = set; then :
+if ${ac_cv_path_GUILE_TOOLS+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   case $GUILE_TOOLS in
@@ -3432,7 +3440,7 @@ CFLAGS="$CFLAGS -I/usr/include/freetype2"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lreadline" >&5
 $as_echo_n "checking for main in -lreadline... " >&6; }
-if test "${ac_cv_lib_readline_main+set}" = set; then :
+if ${ac_cv_lib_readline_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3460,7 +3468,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_main" >&5
 $as_echo "$ac_cv_lib_readline_main" >&6; }
-if test "x$ac_cv_lib_readline_main" = x""yes; then :
+if test "x$ac_cv_lib_readline_main" = xyes; then :
   LIBS="$LIBS -lreadline"
 else
   as_fn_error $? "*** readline library not found!" "$LINENO" 5
@@ -3469,7 +3477,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL" >&5
 $as_echo_n "checking for main in -lSDL... " >&6; }
-if test "${ac_cv_lib_SDL_main+set}" = set; then :
+if ${ac_cv_lib_SDL_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3497,7 +3505,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_main" >&5
 $as_echo "$ac_cv_lib_SDL_main" >&6; }
-if test "x$ac_cv_lib_SDL_main" = x""yes; then :
+if test "x$ac_cv_lib_SDL_main" = xyes; then :
   LIBS="$LIBS -lSDL"
 else
   as_fn_error $? "*** SDL library not found!" "$LINENO" 5
@@ -3506,7 +3514,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL_image" >&5
 $as_echo_n "checking for main in -lSDL_image... " >&6; }
-if test "${ac_cv_lib_SDL_image_main+set}" = set; then :
+if ${ac_cv_lib_SDL_image_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3534,7 +3542,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_image_main" >&5
 $as_echo "$ac_cv_lib_SDL_image_main" >&6; }
-if test "x$ac_cv_lib_SDL_image_main" = x""yes; then :
+if test "x$ac_cv_lib_SDL_image_main" = xyes; then :
   LIBS="$LIBS -lSDL_image"
 else
   as_fn_error $? "*** SDL_image library not found!" "$LINENO" 5
@@ -3543,7 +3551,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL_gfx" >&5
 $as_echo_n "checking for main in -lSDL_gfx... " >&6; }
-if test "${ac_cv_lib_SDL_gfx_main+set}" = set; then :
+if ${ac_cv_lib_SDL_gfx_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3571,7 +3579,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_gfx_main" >&5
 $as_echo "$ac_cv_lib_SDL_gfx_main" >&6; }
-if test "x$ac_cv_lib_SDL_gfx_main" = x""yes; then :
+if test "x$ac_cv_lib_SDL_gfx_main" = xyes; then :
   LIBS="$LIBS -lSDL_gfx"
 else
   as_fn_error $? "*** SDL_gfx library not found!" "$LINENO" 5
@@ -3580,7 +3588,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lSDL_mixer" >&5
 $as_echo_n "checking for main in -lSDL_mixer... " >&6; }
-if test "${ac_cv_lib_SDL_mixer_main+set}" = set; then :
+if ${ac_cv_lib_SDL_mixer_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3608,7 +3616,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL_mixer_main" >&5
 $as_echo "$ac_cv_lib_SDL_mixer_main" >&6; }
-if test "x$ac_cv_lib_SDL_mixer_main" = x""yes; then :
+if test "x$ac_cv_lib_SDL_mixer_main" = xyes; then :
   LIBS="$LIBS -lSDL_mixer"
 else
   as_fn_error $? "*** SDL_mixer library not found!" "$LINENO" 5
@@ -3617,7 +3625,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lGL" >&5
 $as_echo_n "checking for main in -lGL... " >&6; }
-if test "${ac_cv_lib_GL_main+set}" = set; then :
+if ${ac_cv_lib_GL_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3645,7 +3653,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_main" >&5
 $as_echo "$ac_cv_lib_GL_main" >&6; }
-if test "x$ac_cv_lib_GL_main" = x""yes; then :
+if test "x$ac_cv_lib_GL_main" = xyes; then :
   LIBS="$LIBS -lGL"
 else
   as_fn_error $? "*** GL library not found!" "$LINENO" 5
@@ -3654,7 +3662,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lGLU" >&5
 $as_echo_n "checking for main in -lGLU... " >&6; }
-if test "${ac_cv_lib_GLU_main+set}" = set; then :
+if ${ac_cv_lib_GLU_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3682,7 +3690,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GLU_main" >&5
 $as_echo "$ac_cv_lib_GLU_main" >&6; }
-if test "x$ac_cv_lib_GLU_main" = x""yes; then :
+if test "x$ac_cv_lib_GLU_main" = xyes; then :
   LIBS="$LIBS -lGLU"
 else
   as_fn_error $? "*** GLU library not found!" "$LINENO" 5
@@ -3691,7 +3699,7 @@ fi
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lftgl" >&5
 $as_echo_n "checking for main in -lftgl... " >&6; }
-if test "${ac_cv_lib_ftgl_main+set}" = set; then :
+if ${ac_cv_lib_ftgl_main+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3719,7 +3727,7 @@ LIBS=$ac_check_lib_save_LIBS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ftgl_main" >&5
 $as_echo "$ac_cv_lib_ftgl_main" >&6; }
-if test "x$ac_cv_lib_ftgl_main" = x""yes; then :
+if test "x$ac_cv_lib_ftgl_main" = xyes; then :
   LIBS="$LIBS -lftgl"
 else
   as_fn_error $? "*** FTGL library not found!" "$LINENO" 5
@@ -3795,10 +3803,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      :end' >>confcache
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
+    if test "x$cache_file" != "x/dev/null"; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+       cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+         mv -f confcache "$cache_file"$$ &&
+         mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+         mv -f confcache "$cache_file" ;;
+       esac
+      fi
+    fi
   else
     { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -3846,7 +3865,7 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -3947,6 +3966,7 @@ fi
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
 case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4254,7 +4274,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by gacela $as_me 0.5, which was
-generated by GNU Autoconf 2.67.  Invocation command line was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -4320,7 +4340,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 gacela config.status 0.5
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
   with options \\"\$ac_cs_config\\"
 
 Copyright (C) 2010 Free Software Foundation, Inc.
@@ -4453,7 +4473,7 @@ do
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
 
-  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -4476,9 +4496,10 @@ fi
 # after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  tmp=
+  tmp= ac_tmp=
   trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
 ' 0
   trap 'as_fn_exit 1' 1 2 13 15
 }
@@ -4486,12 +4507,13 @@ $debug ||
 
 {
   tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
+  test -d "$tmp"
 }  ||
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
 } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -4513,7 +4535,7 @@ else
   ac_cs_awk_cr=$ac_cr
 fi
 
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
 
 
@@ -4541,7 +4563,7 @@ done
 rm -f conf$$subs.sh
 
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
 sed -n '
 h
@@ -4589,7 +4611,7 @@ t delim
 rm -f conf$$subs.awk
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 _ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
   for (key in S) S_is_set[key] = 1
   FS = "\a"
 
@@ -4621,7 +4643,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
   sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
   cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
   || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
@@ -4655,7 +4677,7 @@ fi # test -n "$CONFIG_FILES"
 # No need to generate them if there are no CONFIG_HEADERS.
 # This happens for instance with `./config.status Makefile'.
 if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
 BEGIN {
 _ACEOF
 
@@ -4667,8 +4689,8 @@ _ACEOF
 # handling of long lines.
 ac_delim='%!_!# '
 for ac_last_try in false false :; do
-  ac_t=`sed -n "/$ac_delim/p" confdefs.h`
-  if test -z "$ac_t"; then
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
     break
   elif $ac_last_try; then
     as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -4769,7 +4791,7 @@ do
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -4788,7 +4810,7 @@ do
     for ac_f
     do
       case $ac_f in
-      -) ac_f="$tmp/stdin";;
+      -) ac_f="$ac_tmp/stdin";;
       *) # Look for the file first in the build tree, then in the source tree
         # (if the path is not absolute).  The absolute path cannot be DOS-style,
         # because $ac_f cannot contain `:'.
@@ -4797,7 +4819,7 @@ do
           [\\/$]*) false;;
           *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
           esac ||
-          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+          as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
       as_fn_append ac_file_inputs " '$ac_f'"
@@ -4823,8 +4845,8 @@ $as_echo "$as_me: creating $ac_file" >&6;}
     esac
 
     case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin" \
-      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -4960,21 +4982,22 @@ s&@INSTALL@&$ac_INSTALL&;t t
 s&@MKDIR_P@&$ac_MKDIR_P&;t t
 $ac_datarootdir_hack
 "
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined" >&2;}
 
-  rm -f "$tmp/stdin"
+  rm -f "$ac_tmp/stdin"
   case $ac_file in
-  -) cat "$tmp/out" && rm -f "$tmp/out";;
-  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
   esac \
   || as_fn_error $? "could not create $ac_file" "$LINENO" 5
  ;;
@@ -4985,20 +5008,20 @@ which seems to be undefined.  Please make sure it is defined" >&2;}
   if test x"$ac_file" != x-; then
     {
       $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
-    } >"$tmp/config.h" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
       || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-    if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
       { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
-      mv "$tmp/config.h" "$ac_file" \
+      mv "$ac_tmp/config.h" "$ac_file" \
        || as_fn_error $? "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
-      && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
       || as_fn_error $? "could not create -" "$LINENO" 5
   fi
 # Compute "$ac_file"'s index in $config_headers.
diff --git a/src/gacela_SDL.c b/src/gacela_SDL.c
deleted file mode 100644 (file)
index f950002..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-/* Gacela, a GNU Guile extension for fast games development
-   Copyright (C) 2009 by Javier Sancho Fernandez <jsf at jsancho dot 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 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <libguile.h>
-#include <SDL/SDL.h>
-#include <SDL/SDL_events.h>
-#include <SDL/SDL_image.h>
-#include <SDL/SDL_mixer.h>
-#include <SDL/SDL_rotozoom.h>
-#include "gacela_SDL.h"
-
-struct surface
-{
-  SCM filename;
-  SDL_Surface *surface_address;
-};
-
-static scm_t_bits surface_tag;
-
-SCM
-make_surface (SCM file, SDL_Surface *surface_address)
-{
-  SCM smob;
-  struct surface *surface;
-
-  surface = (struct surface *) scm_gc_malloc (sizeof (struct surface), "surface");
-
-  surface->filename = SCM_BOOL_F;
-  surface->surface_address = NULL;
-
-  SCM_NEWSMOB (smob, surface_tag, surface);
-
-  surface->filename = file;
-  surface->surface_address = surface_address;
-
-  return smob;
-}
-
-SDL_Surface *
-get_surface_address (SCM surface_smob)
-{
-  struct surface *surface;
-
-  scm_assert_smob_type (surface_tag, surface_smob);
-  surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
-  return surface->surface_address;
-}
-
-SCM
-get_surface_filename (SCM surface_smob)
-{
-  struct surface *surface;
-
-  scm_assert_smob_type (surface_tag, surface_smob);
-  surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
-  return surface->filename;
-}
-
-SCM
-get_surface_width (SCM surface_smob)
-{
-  SDL_Surface *surface = get_surface_address (surface_smob);
-
-  return scm_from_int (surface->w);
-}
-
-SCM
-get_surface_height (SCM surface_smob)
-{
-  SDL_Surface *surface = get_surface_address (surface_smob);
-
-  return scm_from_int (surface->h);
-}
-
-SCM
-get_surface_pixels (SCM surface_smob)
-{
-  SDL_Surface *surface = get_surface_address (surface_smob);
-
-  return scm_from_int ((int)surface->pixels);
-}
-
-SCM
-get_surface_format_BytesPerPixel (SCM surface_smob)
-{
-  SDL_Surface *surface = get_surface_address (surface_smob);
-
-  return scm_from_int (surface->format->BytesPerPixel);
-}
-
-SCM
-mark_surface (SCM surface_smob)
-{
-  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
-
-  scm_gc_mark (surface->filename);
-     
-  return SCM_BOOL_F;
-}
-
-size_t
-free_surface (SCM surface_smob)
-{
-  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
-
-  SDL_FreeSurface (surface->surface_address);
-  scm_gc_free (surface, sizeof (struct surface), "surface");
-
-  return 0;
-}
-
-static int
-print_surface (SCM surface_smob, SCM port, scm_print_state *pstate)
-{
-  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
-
-  scm_puts ("#<surface \"", port);
-  scm_display (surface->filename, port);
-  scm_puts ("\">", port);
-
-  /* non-zero means success */
-  return 1;
-}
-
-
-SCM
-gacela_SDL_Init (SCM flags)
-{
-  return scm_from_int (SDL_Init (scm_to_int (flags)));
-}
-
-SCM
-gacela_SDL_Quit (void)
-{
-  SDL_Quit ();
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_SDL_SetVideoMode (SCM width, SCM height, SCM bpp, SCM flags)
-{
-  SDL_Surface *screen = SDL_SetVideoMode (scm_to_int (width), scm_to_int (height), \
-                                         scm_to_int (bpp), scm_to_int (flags));
-
-  if (screen) {
-    return make_surface (scm_from_locale_string ("screen"), screen);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_SDL_FreeSurface (SCM surface)
-{
-  return scm_from_int (free_surface (surface));
-}
-
-SCM
-gacela_SDL_WM_SetCaption (SCM title, SCM icon)
-{
-  SDL_WM_SetCaption (scm_to_locale_string(title), scm_to_locale_string(icon));
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_SDL_Flip (SCM screen)
-{
-  return scm_from_int (SDL_Flip (get_surface_address (screen)));
-}
-
-SCM
-gacela_SDL_Delay (SCM ms)
-{
-  SDL_Delay ((int)scm_to_double (ms));
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_SDL_GetTicks (void)
-{
-  return scm_from_int (SDL_GetTicks ());
-}
-
-SCM
-gacela_SDL_DisplayFormat (SCM surface)
-{
-  SDL_Surface *new = SDL_DisplayFormat (get_surface_address (surface));
-
-  if (new) {
-    return make_surface (get_surface_filename (surface), new);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_SDL_DisplayFormatAlpha (SCM surface)
-{
-  SDL_Surface *new = SDL_DisplayFormatAlpha (get_surface_address (surface));
-
-  if (new) {
-    return make_surface (get_surface_filename (surface), new);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_SDL_MapRGB (SCM format, SCM r, SCM g, SCM b)
-{
-  return scm_from_int (SDL_MapRGB ((SDL_PixelFormat *)scm_to_int (format), scm_to_int (r), scm_to_int (g), scm_to_int (b)));
-}
-
-SCM
-gacela_SDL_SetColorKey (SCM surface, SCM flag, SCM key)
-{
-  return scm_from_int (SDL_SetColorKey (get_surface_address (surface), scm_to_int (flag), scm_to_int (key)));
-}
-
-SCM
-gacela_SDL_SetAlpha (SCM surface, SCM flag, SCM alpha)
-{
-  return scm_from_int (SDL_SetAlpha (get_surface_address (surface), scm_to_int (flag), scm_to_int (alpha)));
-}
-
-SCM
-gacela_SDL_LoadBMP (SCM file)
-{
-  SDL_Surface *image = SDL_LoadBMP (scm_to_locale_string (file));
-
-  if (image) {
-    return make_surface (file, image);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_IMG_Load (SCM filename)
-{
-  SDL_Surface *image = IMG_Load (scm_to_locale_string (filename));
-
-  if (image) {
-    return make_surface (filename, image);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_SDL_GetVideoInfo (void)
-{
-  const SDL_VideoInfo *info;
-  SCM vi;
-
-  info = SDL_GetVideoInfo ();
-  vi = scm_list_n (SCM_UNDEFINED);
-
-  vi = scm_cons (scm_cons (scm_from_locale_symbol ("blit_hw"), scm_from_int (info->blit_hw)), vi);
-  vi = scm_cons (scm_cons (scm_from_locale_symbol ("hw_available"), scm_from_int (info->hw_available)), vi);
-
-  return vi;
-}
-
-SCM
-gacela_SDL_GL_SetAttribute (SCM attr, SCM value)
-{
-  return scm_from_int (SDL_GL_SetAttribute (scm_to_int (attr), scm_to_int (value)));
-}
-
-SCM
-gacela_SDL_PollEvent (void)
-{
-  SDL_Event sdl_event;
-  SCM event;
-
-  event = scm_list_n (SCM_UNDEFINED);
-
-  if (SDL_PollEvent (&sdl_event)) {
-    switch (sdl_event.type) {
-    case SDL_KEYDOWN:
-    case SDL_KEYUP:
-      event = scm_cons (scm_cons (scm_from_locale_symbol ("key.keysym.sym"), scm_from_int (sdl_event.key.keysym.sym)), event);
-      break;
-    }
-    event = scm_cons (scm_cons (scm_from_locale_symbol ("type"), scm_from_int (sdl_event.type)), event);
-  }
-
-  return event;
-}
-
-SCM
-gacela_SDL_GL_SwapBuffers (void)
-{
-  SDL_GL_SwapBuffers ();
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_SDL_EnableKeyRepeat (SCM delay, SCM interval)
-{
-  return scm_from_int (SDL_EnableKeyRepeat (scm_to_int (delay), scm_to_int (interval)));
-}
-
-SCM
-gacela_zoomSurface (SCM src, SCM zoomx, SCM zoomy, SCM smooth)
-{
-  SDL_Surface *image = zoomSurface (get_surface_address (src), scm_to_double (zoomx), scm_to_double (zoomy), scm_to_int (smooth));
-
-  if (image) {
-    return make_surface (get_surface_filename (src), image);
-  }
-  else {
-    return SCM_BOOL_F;
-  }
-}
-
-SCM
-gacela_Mix_OpenAudio (SCM frequency, SCM format, SCM channels, SCM chunksize)
-{
-  return scm_from_int (Mix_OpenAudio (scm_to_int (frequency), scm_to_int (format), scm_to_int (channels), scm_to_int (chunksize)));
-}
-
-SCM
-gacela_Mix_LoadMUS (SCM file)
-{
-  return scm_from_int ((int)Mix_LoadMUS (scm_to_locale_string (file)));
-}
-
-SCM
-gacela_Mix_LoadWAV (SCM file)
-{
-  return scm_from_int ((int)Mix_LoadWAV (scm_to_locale_string (file)));
-}
-
-SCM
-gacela_Mix_PlayChannel (SCM channel, SCM chunk, SCM loops)
-{
-  return scm_from_int (Mix_PlayChannel (scm_to_int (channel), (Mix_Chunk *)scm_to_int (chunk), scm_to_int (loops)));
-}
-
-SCM
-gacela_Mix_PlayMusic (SCM music, SCM loops)
-{
-  return scm_from_int (Mix_PlayMusic ((Mix_Music *)scm_to_int (music), scm_to_int (loops)));
-}
-
-SCM
-gacela_Mix_PlayingMusic (void)
-{
-  return scm_from_int (Mix_PlayingMusic ());
-}
-
-SCM
-gacela_Mix_PausedMusic (void)
-{
-  return scm_from_int (Mix_PausedMusic ());
-}
-
-SCM
-gacela_Mix_PauseMusic (void)
-{
-  Mix_PauseMusic ();
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_Mix_ResumeMusic (void)
-{
-  Mix_ResumeMusic ();
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_Mix_HaltMusic (void)
-{
-  return scm_from_int (Mix_HaltMusic ());
-}
-
-SCM
-gacela_Mix_FreeMusic (SCM music)
-{
-  Mix_FreeMusic ((Mix_Music *)scm_to_int (music));
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_Mix_FreeChunk (SCM chunk)
-{
-  Mix_FreeChunk ((Mix_Chunk *)scm_to_int (chunk));
-  return SCM_UNSPECIFIED;
-}
-
-SCM
-gacela_Mix_CloseAudio (void)
-{
-  Mix_CloseAudio ();
-  return SCM_UNSPECIFIED;
-}
-
-
-void
-init_guile_SDL ()
-{
-  surface_tag = scm_make_smob_type ("surface", sizeof (struct surface));
-  scm_set_smob_mark (surface_tag, mark_surface);
-  scm_set_smob_free (surface_tag, free_surface);
-  scm_set_smob_print (surface_tag, print_surface);
-  scm_c_define_gsubr ("surface-file", 1, 0, 0, get_surface_filename);
-  scm_c_define_gsubr ("surface-w", 1, 0, 0, get_surface_width);
-  scm_c_define_gsubr ("surface-h", 1, 0, 0, get_surface_height);
-  scm_c_define_gsubr ("surface-pixels", 1, 0, 0, get_surface_pixels);
-  scm_c_define_gsubr ("surface-format-BytesPerPixel", 1, 0, 0, get_surface_format_BytesPerPixel);
-
-  scm_c_define ("SDL_INIT_TIMER", scm_from_int (SDL_INIT_TIMER));
-  scm_c_define ("SDL_INIT_AUDIO", scm_from_int (SDL_INIT_AUDIO));
-  scm_c_define ("SDL_INIT_VIDEO", scm_from_int (SDL_INIT_VIDEO));
-  scm_c_define ("SDL_INIT_CDROM", scm_from_int (SDL_INIT_CDROM));
-  scm_c_define ("SDL_INIT_JOYSTICK", scm_from_int (SDL_INIT_JOYSTICK));
-  scm_c_define ("SDL_INIT_NOPARACHUTE", scm_from_int (SDL_INIT_NOPARACHUTE));
-  scm_c_define ("SDL_INIT_EVENTTHREAD", scm_from_int (SDL_INIT_EVENTTHREAD));
-  scm_c_define ("SDL_INIT_EVERYTHING", scm_from_int (SDL_INIT_EVERYTHING));
-
-  scm_c_define ("SDL_SWSURFACE", scm_from_int (SDL_SWSURFACE));
-  scm_c_define ("SDL_HWSURFACE", scm_from_int (SDL_HWSURFACE));
-  scm_c_define ("SDL_ASYNCBLIT", scm_from_int (SDL_ASYNCBLIT));
-
-  scm_c_define ("SDL_ANYFORMAT", scm_from_int (SDL_ANYFORMAT));
-  scm_c_define ("SDL_HWPALETTE", scm_from_int (SDL_HWPALETTE));
-  scm_c_define ("SDL_DOUBLEBUF", scm_from_int (SDL_DOUBLEBUF));
-  scm_c_define ("SDL_FULLSCREEN", scm_from_int (SDL_FULLSCREEN));
-  scm_c_define ("SDL_OPENGL", scm_from_int (SDL_OPENGL));
-  scm_c_define ("SDL_OPENGLBLIT", scm_from_int (SDL_OPENGLBLIT));
-  scm_c_define ("SDL_RESIZABLE", scm_from_int (SDL_RESIZABLE));
-  scm_c_define ("SDL_NOFRAME", scm_from_int (SDL_NOFRAME));
-
-  scm_c_define ("SDL_HWACCEL", scm_from_int (SDL_HWACCEL));
-  scm_c_define ("SDL_SRCCOLORKEY", scm_from_int (SDL_SRCCOLORKEY));
-
-  scm_c_define ("SDL_GL_DOUBLEBUFFER", scm_from_int (SDL_GL_DOUBLEBUFFER));
-
-  scm_c_define ("SDL_DEFAULT_REPEAT_DELAY", scm_from_int (SDL_DEFAULT_REPEAT_DELAY));
-  scm_c_define ("SDL_DEFAULT_REPEAT_INTERVAL", scm_from_int (SDL_DEFAULT_REPEAT_INTERVAL));
-
-  scm_c_define ("SDL_LIL_ENDIAN", scm_from_int (SDL_LIL_ENDIAN));
-  scm_c_define ("SDL_BIG_ENDIAN", scm_from_int (SDL_BIG_ENDIAN));
-  scm_c_define ("SDL_BYTEORDER", scm_from_int (SDL_BYTEORDER));
-
-  scm_c_define ("MIX_DEFAULT_FORMAT", scm_from_int (MIX_DEFAULT_FORMAT));
-
-  scm_c_define ("SDL_NOEVENT", scm_from_int (SDL_NOEVENT));
-  scm_c_define ("SDL_ACTIVEEVENT", scm_from_int (SDL_ACTIVEEVENT));
-  scm_c_define ("SDL_KEYDOWN", scm_from_int (SDL_KEYDOWN));
-  scm_c_define ("SDL_KEYUP", scm_from_int (SDL_KEYUP));
-  scm_c_define ("SDL_MOUSEMOTION", scm_from_int (SDL_MOUSEMOTION));
-  scm_c_define ("SDL_MOUSEBUTTONDOWN", scm_from_int (SDL_MOUSEBUTTONDOWN));
-  scm_c_define ("SDL_MOUSEBUTTONUP", scm_from_int (SDL_MOUSEBUTTONUP));
-  scm_c_define ("SDL_JOYAXISMOTION", scm_from_int (SDL_JOYAXISMOTION));
-  scm_c_define ("SDL_JOYBALLMOTION", scm_from_int (SDL_JOYBALLMOTION));
-  scm_c_define ("SDL_JOYHATMOTION", scm_from_int (SDL_JOYHATMOTION));
-  scm_c_define ("SDL_JOYBUTTONDOWN", scm_from_int (SDL_JOYBUTTONDOWN));
-  scm_c_define ("SDL_JOYBUTTONUP", scm_from_int (SDL_JOYBUTTONUP));
-  scm_c_define ("SDL_QUIT", scm_from_int (SDL_QUIT));
-  scm_c_define ("SDL_SYSWMEVENT", scm_from_int (SDL_SYSWMEVENT));
-  scm_c_define ("SDL_EVENT_RESERVEDA", scm_from_int (SDL_EVENT_RESERVEDA));
-  scm_c_define ("SDL_EVENT_RESERVEDB", scm_from_int (SDL_EVENT_RESERVEDB));
-  scm_c_define ("SDL_VIDEORESIZE", scm_from_int (SDL_VIDEORESIZE));
-  scm_c_define ("SDL_VIDEOEXPOSE", scm_from_int (SDL_VIDEOEXPOSE));
-  scm_c_define ("SDL_EVENT_RESERVED2", scm_from_int (SDL_EVENT_RESERVED2));
-  scm_c_define ("SDL_EVENT_RESERVED3", scm_from_int (SDL_EVENT_RESERVED3));
-  scm_c_define ("SDL_EVENT_RESERVED4", scm_from_int (SDL_EVENT_RESERVED4));
-  scm_c_define ("SDL_EVENT_RESERVED5", scm_from_int (SDL_EVENT_RESERVED5));
-  scm_c_define ("SDL_EVENT_RESERVED6", scm_from_int (SDL_EVENT_RESERVED6));
-  scm_c_define ("SDL_EVENT_RESERVED7", scm_from_int (SDL_EVENT_RESERVED7));
-  scm_c_define ("SDL_USEREVENT", scm_from_int (SDL_USEREVENT));
-  scm_c_define ("SDL_NUMEVENTS", scm_from_int (SDL_NUMEVENTS));
-
-  scm_c_define_gsubr ("SDL_Init", 1, 0, 0, gacela_SDL_Init);
-  scm_c_define_gsubr ("SDL_Quit", 0, 0, 0, gacela_SDL_Quit);
-  scm_c_define_gsubr ("SDL_SetVideoMode", 4, 0, 0, gacela_SDL_SetVideoMode);
-  scm_c_define_gsubr ("SDL_FreeSurface", 1, 0, 0, gacela_SDL_FreeSurface);
-  scm_c_define_gsubr ("SDL_WM_SetCaption", 2, 0, 0, gacela_SDL_WM_SetCaption);
-  scm_c_define_gsubr ("SDL_Flip", 1, 0, 0, gacela_SDL_Flip);
-  scm_c_define_gsubr ("SDL_Delay", 1, 0, 0, gacela_SDL_Delay);
-  scm_c_define_gsubr ("SDL_GetTicks", 0, 0, 0, gacela_SDL_GetTicks);
-  scm_c_define_gsubr ("SDL_DisplayFormat", 1, 0, 0, gacela_SDL_DisplayFormat);
-  scm_c_define_gsubr ("SDL_DisplayFormatAlpha", 1, 0, 0, gacela_SDL_DisplayFormatAlpha);
-  scm_c_define_gsubr ("SDL_MapRGB", 4, 0, 0, gacela_SDL_MapRGB);
-  scm_c_define_gsubr ("SDL_SetColorKey", 3, 0, 0, gacela_SDL_SetColorKey);
-  scm_c_define_gsubr ("SDL_SetAlpha", 3, 0, 0, gacela_SDL_SetAlpha);
-  scm_c_define_gsubr ("SDL_LoadBMP", 1, 0, 0, gacela_SDL_LoadBMP);
-  scm_c_define_gsubr ("IMG_Load", 1, 0, 0, gacela_IMG_Load);
-  scm_c_define_gsubr ("SDL_GetVideoInfo", 0, 0, 0, gacela_SDL_GetVideoInfo);
-  scm_c_define_gsubr ("SDL_GL_SetAttribute", 2, 0, 0, gacela_SDL_GL_SetAttribute);
-  scm_c_define_gsubr ("SDL_PollEvent", 0, 0, 0, gacela_SDL_PollEvent);
-  scm_c_define_gsubr ("SDL_GL_SwapBuffers", 0, 0, 0, gacela_SDL_GL_SwapBuffers);
-  scm_c_define_gsubr ("SDL_EnableKeyRepeat", 2, 0, 0, gacela_SDL_EnableKeyRepeat);
-  scm_c_define_gsubr ("zoomSurface", 4, 0, 0, gacela_zoomSurface);
-  scm_c_define_gsubr ("Mix_OpenAudio", 4, 0, 0, gacela_Mix_OpenAudio);
-  scm_c_define_gsubr ("Mix_LoadMUS", 1, 0, 0, gacela_Mix_LoadMUS);
-  scm_c_define_gsubr ("Mix_LoadWAV", 1, 0, 0, gacela_Mix_LoadWAV);
-  scm_c_define_gsubr ("Mix_PlayChannel", 3, 0, 0, gacela_Mix_PlayChannel);
-  scm_c_define_gsubr ("Mix_PlayMusic", 2, 0, 0, gacela_Mix_PlayMusic);
-  scm_c_define_gsubr ("Mix_PlayingMusic", 0, 0, 0, gacela_Mix_PlayingMusic);
-  scm_c_define_gsubr ("Mix_PausedMusic", 0, 0, 0, gacela_Mix_PausedMusic);
-  scm_c_define_gsubr ("Mix_PauseMusic", 0, 0, 0, gacela_Mix_PauseMusic);
-  scm_c_define_gsubr ("Mix_ResumeMusic", 0, 0, 0, gacela_Mix_ResumeMusic);
-  scm_c_define_gsubr ("Mix_HaltMusic", 0, 0, 0, gacela_Mix_HaltMusic);
-  scm_c_define_gsubr ("Mix_FreeMusic", 1, 0, 0, gacela_Mix_FreeMusic);
-  scm_c_define_gsubr ("Mix_FreeChunk", 1, 0, 0, gacela_Mix_FreeChunk);
-  scm_c_define_gsubr ("Mix_CloseAudio", 0, 0, 0, gacela_Mix_CloseAudio);
-}
diff --git a/src/gacela_SDL.h b/src/gacela_SDL.h
deleted file mode 100644 (file)
index f3b0e67..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Gacela, a GNU Guile extension for fast games development
-   Copyright (C) 2009 by Javier Sancho Fernandez <jsf at jsancho dot 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 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-void* SDL_register_functions (void* data);
diff --git a/src/sdl.c b/src/sdl.c
new file mode 100644 (file)
index 0000000..8b9791a
--- /dev/null
+++ b/src/sdl.c
@@ -0,0 +1,537 @@
+/* Gacela, a GNU Guile extension for fast games development
+   Copyright (C) 2009 by Javier Sancho Fernandez <jsf at jsancho dot 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 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <libguile.h>
+#include <SDL/SDL.h>
+#include <SDL/SDL_events.h>
+#include <SDL/SDL_image.h>
+#include <SDL/SDL_mixer.h>
+#include <SDL/SDL_rotozoom.h>
+#include "gacela_SDL.h"
+
+struct surface
+{
+  SCM filename;
+  SDL_Surface *surface_address;
+};
+
+static scm_t_bits surface_tag;
+
+SCM
+make_surface (SCM file, SDL_Surface *surface_address)
+{
+  SCM smob;
+  struct surface *surface;
+
+  surface = (struct surface *) scm_gc_malloc (sizeof (struct surface), "surface");
+
+  surface->filename = SCM_BOOL_F;
+  surface->surface_address = NULL;
+
+  SCM_NEWSMOB (smob, surface_tag, surface);
+
+  surface->filename = file;
+  surface->surface_address = surface_address;
+
+  return smob;
+}
+
+SDL_Surface *
+get_surface_address (SCM surface_smob)
+{
+  struct surface *surface;
+
+  scm_assert_smob_type (surface_tag, surface_smob);
+  surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
+  return surface->surface_address;
+}
+
+SCM
+get_surface_filename (SCM surface_smob)
+{
+  struct surface *surface;
+
+  scm_assert_smob_type (surface_tag, surface_smob);
+  surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
+  return surface->filename;
+}
+
+SCM
+get_surface_width (SCM surface_smob)
+{
+  SDL_Surface *surface = get_surface_address (surface_smob);
+
+  return scm_from_int (surface->w);
+}
+
+SCM
+get_surface_height (SCM surface_smob)
+{
+  SDL_Surface *surface = get_surface_address (surface_smob);
+
+  return scm_from_int (surface->h);
+}
+
+SCM
+get_surface_pixels (SCM surface_smob)
+{
+  SDL_Surface *surface = get_surface_address (surface_smob);
+
+  return scm_from_int ((int)surface->pixels);
+}
+
+SCM
+get_surface_format_BytesPerPixel (SCM surface_smob)
+{
+  SDL_Surface *surface = get_surface_address (surface_smob);
+
+  return scm_from_int (surface->format->BytesPerPixel);
+}
+
+SCM
+mark_surface (SCM surface_smob)
+{
+  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
+
+  scm_gc_mark (surface->filename);
+     
+  return SCM_BOOL_F;
+}
+
+size_t
+free_surface (SCM surface_smob)
+{
+  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
+
+  SDL_FreeSurface (surface->surface_address);
+  scm_gc_free (surface, sizeof (struct surface), "surface");
+
+  return 0;
+}
+
+static int
+print_surface (SCM surface_smob, SCM port, scm_print_state *pstate)
+{
+  struct surface *surface = (struct surface *) SCM_SMOB_DATA (surface_smob);
+
+  scm_puts ("#<surface \"", port);
+  scm_display (surface->filename, port);
+  scm_puts ("\">", port);
+
+  /* non-zero means success */
+  return 1;
+}
+
+
+SCM
+gacela_SDL_Init (SCM flags)
+{
+  return scm_from_int (SDL_Init (scm_to_int (flags)));
+}
+
+SCM
+gacela_SDL_Quit (void)
+{
+  SDL_Quit ();
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_SDL_SetVideoMode (SCM width, SCM height, SCM bpp, SCM flags)
+{
+  SDL_Surface *screen = SDL_SetVideoMode (scm_to_int (width), scm_to_int (height), \
+                                         scm_to_int (bpp), scm_to_int (flags));
+
+  if (screen) {
+    return make_surface (scm_from_locale_string ("screen"), screen);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_SDL_FreeSurface (SCM surface)
+{
+  return scm_from_int (free_surface (surface));
+}
+
+SCM
+gacela_SDL_WM_SetCaption (SCM title, SCM icon)
+{
+  SDL_WM_SetCaption (scm_to_locale_string(title), scm_to_locale_string(icon));
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_SDL_Flip (SCM screen)
+{
+  return scm_from_int (SDL_Flip (get_surface_address (screen)));
+}
+
+SCM
+gacela_SDL_Delay (SCM ms)
+{
+  SDL_Delay ((int)scm_to_double (ms));
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_SDL_GetTicks (void)
+{
+  return scm_from_int (SDL_GetTicks ());
+}
+
+SCM
+gacela_SDL_DisplayFormat (SCM surface)
+{
+  SDL_Surface *new = SDL_DisplayFormat (get_surface_address (surface));
+
+  if (new) {
+    return make_surface (get_surface_filename (surface), new);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_SDL_DisplayFormatAlpha (SCM surface)
+{
+  SDL_Surface *new = SDL_DisplayFormatAlpha (get_surface_address (surface));
+
+  if (new) {
+    return make_surface (get_surface_filename (surface), new);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_SDL_MapRGB (SCM format, SCM r, SCM g, SCM b)
+{
+  return scm_from_int (SDL_MapRGB ((SDL_PixelFormat *)scm_to_int (format), scm_to_int (r), scm_to_int (g), scm_to_int (b)));
+}
+
+SCM
+gacela_SDL_SetColorKey (SCM surface, SCM flag, SCM key)
+{
+  return scm_from_int (SDL_SetColorKey (get_surface_address (surface), scm_to_int (flag), scm_to_int (key)));
+}
+
+SCM
+gacela_SDL_SetAlpha (SCM surface, SCM flag, SCM alpha)
+{
+  return scm_from_int (SDL_SetAlpha (get_surface_address (surface), scm_to_int (flag), scm_to_int (alpha)));
+}
+
+SCM
+gacela_SDL_LoadBMP (SCM file)
+{
+  SDL_Surface *image = SDL_LoadBMP (scm_to_locale_string (file));
+
+  if (image) {
+    return make_surface (file, image);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_IMG_Load (SCM filename)
+{
+  SDL_Surface *image = IMG_Load (scm_to_locale_string (filename));
+
+  if (image) {
+    return make_surface (filename, image);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_SDL_GetVideoInfo (void)
+{
+  const SDL_VideoInfo *info;
+  SCM vi;
+
+  info = SDL_GetVideoInfo ();
+  vi = scm_list_n (SCM_UNDEFINED);
+
+  vi = scm_cons (scm_cons (scm_from_locale_symbol ("blit_hw"), scm_from_int (info->blit_hw)), vi);
+  vi = scm_cons (scm_cons (scm_from_locale_symbol ("hw_available"), scm_from_int (info->hw_available)), vi);
+
+  return vi;
+}
+
+SCM
+gacela_SDL_GL_SetAttribute (SCM attr, SCM value)
+{
+  return scm_from_int (SDL_GL_SetAttribute (scm_to_int (attr), scm_to_int (value)));
+}
+
+SCM
+gacela_SDL_PollEvent (void)
+{
+  SDL_Event sdl_event;
+  SCM event;
+
+  event = scm_list_n (SCM_UNDEFINED);
+
+  if (SDL_PollEvent (&sdl_event)) {
+    switch (sdl_event.type) {
+    case SDL_KEYDOWN:
+    case SDL_KEYUP:
+      event = scm_cons (scm_cons (scm_from_locale_symbol ("key.keysym.sym"), scm_from_int (sdl_event.key.keysym.sym)), event);
+      break;
+    }
+    event = scm_cons (scm_cons (scm_from_locale_symbol ("type"), scm_from_int (sdl_event.type)), event);
+  }
+
+  return event;
+}
+
+SCM
+gacela_SDL_GL_SwapBuffers (void)
+{
+  SDL_GL_SwapBuffers ();
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_SDL_EnableKeyRepeat (SCM delay, SCM interval)
+{
+  return scm_from_int (SDL_EnableKeyRepeat (scm_to_int (delay), scm_to_int (interval)));
+}
+
+SCM
+gacela_zoomSurface (SCM src, SCM zoomx, SCM zoomy, SCM smooth)
+{
+  SDL_Surface *image = zoomSurface (get_surface_address (src), scm_to_double (zoomx), scm_to_double (zoomy), scm_to_int (smooth));
+
+  if (image) {
+    return make_surface (get_surface_filename (src), image);
+  }
+  else {
+    return SCM_BOOL_F;
+  }
+}
+
+SCM
+gacela_Mix_OpenAudio (SCM frequency, SCM format, SCM channels, SCM chunksize)
+{
+  return scm_from_int (Mix_OpenAudio (scm_to_int (frequency), scm_to_int (format), scm_to_int (channels), scm_to_int (chunksize)));
+}
+
+SCM
+gacela_Mix_LoadMUS (SCM file)
+{
+  return scm_from_int ((int)Mix_LoadMUS (scm_to_locale_string (file)));
+}
+
+SCM
+gacela_Mix_LoadWAV (SCM file)
+{
+  return scm_from_int ((int)Mix_LoadWAV (scm_to_locale_string (file)));
+}
+
+SCM
+gacela_Mix_PlayChannel (SCM channel, SCM chunk, SCM loops)
+{
+  return scm_from_int (Mix_PlayChannel (scm_to_int (channel), (Mix_Chunk *)scm_to_int (chunk), scm_to_int (loops)));
+}
+
+SCM
+gacela_Mix_PlayMusic (SCM music, SCM loops)
+{
+  return scm_from_int (Mix_PlayMusic ((Mix_Music *)scm_to_int (music), scm_to_int (loops)));
+}
+
+SCM
+gacela_Mix_PlayingMusic (void)
+{
+  return scm_from_int (Mix_PlayingMusic ());
+}
+
+SCM
+gacela_Mix_PausedMusic (void)
+{
+  return scm_from_int (Mix_PausedMusic ());
+}
+
+SCM
+gacela_Mix_PauseMusic (void)
+{
+  Mix_PauseMusic ();
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_Mix_ResumeMusic (void)
+{
+  Mix_ResumeMusic ();
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_Mix_HaltMusic (void)
+{
+  return scm_from_int (Mix_HaltMusic ());
+}
+
+SCM
+gacela_Mix_FreeMusic (SCM music)
+{
+  Mix_FreeMusic ((Mix_Music *)scm_to_int (music));
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_Mix_FreeChunk (SCM chunk)
+{
+  Mix_FreeChunk ((Mix_Chunk *)scm_to_int (chunk));
+  return SCM_UNSPECIFIED;
+}
+
+SCM
+gacela_Mix_CloseAudio (void)
+{
+  Mix_CloseAudio ();
+  return SCM_UNSPECIFIED;
+}
+
+
+void
+init_gacela_sdl (void *data)
+{
+  surface_tag = scm_make_smob_type ("surface", sizeof (struct surface));
+  scm_set_smob_mark (surface_tag, mark_surface);
+  scm_set_smob_free (surface_tag, free_surface);
+  scm_set_smob_print (surface_tag, print_surface);
+  scm_c_define_gsubr ("surface-file", 1, 0, 0, get_surface_filename);
+  scm_c_define_gsubr ("surface-w", 1, 0, 0, get_surface_width);
+  scm_c_define_gsubr ("surface-h", 1, 0, 0, get_surface_height);
+  scm_c_define_gsubr ("surface-pixels", 1, 0, 0, get_surface_pixels);
+  scm_c_define_gsubr ("surface-format-BytesPerPixel", 1, 0, 0, get_surface_format_BytesPerPixel);
+
+  scm_c_define ("SDL_INIT_TIMER", scm_from_int (SDL_INIT_TIMER));
+  scm_c_define ("SDL_INIT_AUDIO", scm_from_int (SDL_INIT_AUDIO));
+  scm_c_define ("SDL_INIT_VIDEO", scm_from_int (SDL_INIT_VIDEO));
+  scm_c_define ("SDL_INIT_CDROM", scm_from_int (SDL_INIT_CDROM));
+  scm_c_define ("SDL_INIT_JOYSTICK", scm_from_int (SDL_INIT_JOYSTICK));
+  scm_c_define ("SDL_INIT_NOPARACHUTE", scm_from_int (SDL_INIT_NOPARACHUTE));
+  scm_c_define ("SDL_INIT_EVENTTHREAD", scm_from_int (SDL_INIT_EVENTTHREAD));
+  scm_c_define ("SDL_INIT_EVERYTHING", scm_from_int (SDL_INIT_EVERYTHING));
+
+  scm_c_define ("SDL_SWSURFACE", scm_from_int (SDL_SWSURFACE));
+  scm_c_define ("SDL_HWSURFACE", scm_from_int (SDL_HWSURFACE));
+  scm_c_define ("SDL_ASYNCBLIT", scm_from_int (SDL_ASYNCBLIT));
+
+  scm_c_define ("SDL_ANYFORMAT", scm_from_int (SDL_ANYFORMAT));
+  scm_c_define ("SDL_HWPALETTE", scm_from_int (SDL_HWPALETTE));
+  scm_c_define ("SDL_DOUBLEBUF", scm_from_int (SDL_DOUBLEBUF));
+  scm_c_define ("SDL_FULLSCREEN", scm_from_int (SDL_FULLSCREEN));
+  scm_c_define ("SDL_OPENGL", scm_from_int (SDL_OPENGL));
+  scm_c_define ("SDL_OPENGLBLIT", scm_from_int (SDL_OPENGLBLIT));
+  scm_c_define ("SDL_RESIZABLE", scm_from_int (SDL_RESIZABLE));
+  scm_c_define ("SDL_NOFRAME", scm_from_int (SDL_NOFRAME));
+
+  scm_c_define ("SDL_HWACCEL", scm_from_int (SDL_HWACCEL));
+  scm_c_define ("SDL_SRCCOLORKEY", scm_from_int (SDL_SRCCOLORKEY));
+
+  scm_c_define ("SDL_GL_DOUBLEBUFFER", scm_from_int (SDL_GL_DOUBLEBUFFER));
+
+  scm_c_define ("SDL_DEFAULT_REPEAT_DELAY", scm_from_int (SDL_DEFAULT_REPEAT_DELAY));
+  scm_c_define ("SDL_DEFAULT_REPEAT_INTERVAL", scm_from_int (SDL_DEFAULT_REPEAT_INTERVAL));
+
+  scm_c_define ("SDL_LIL_ENDIAN", scm_from_int (SDL_LIL_ENDIAN));
+  scm_c_define ("SDL_BIG_ENDIAN", scm_from_int (SDL_BIG_ENDIAN));
+  scm_c_define ("SDL_BYTEORDER", scm_from_int (SDL_BYTEORDER));
+
+  scm_c_define ("MIX_DEFAULT_FORMAT", scm_from_int (MIX_DEFAULT_FORMAT));
+
+  scm_c_define ("SDL_NOEVENT", scm_from_int (SDL_NOEVENT));
+  scm_c_define ("SDL_ACTIVEEVENT", scm_from_int (SDL_ACTIVEEVENT));
+  scm_c_define ("SDL_KEYDOWN", scm_from_int (SDL_KEYDOWN));
+  scm_c_define ("SDL_KEYUP", scm_from_int (SDL_KEYUP));
+  scm_c_define ("SDL_MOUSEMOTION", scm_from_int (SDL_MOUSEMOTION));
+  scm_c_define ("SDL_MOUSEBUTTONDOWN", scm_from_int (SDL_MOUSEBUTTONDOWN));
+  scm_c_define ("SDL_MOUSEBUTTONUP", scm_from_int (SDL_MOUSEBUTTONUP));
+  scm_c_define ("SDL_JOYAXISMOTION", scm_from_int (SDL_JOYAXISMOTION));
+  scm_c_define ("SDL_JOYBALLMOTION", scm_from_int (SDL_JOYBALLMOTION));
+  scm_c_define ("SDL_JOYHATMOTION", scm_from_int (SDL_JOYHATMOTION));
+  scm_c_define ("SDL_JOYBUTTONDOWN", scm_from_int (SDL_JOYBUTTONDOWN));
+  scm_c_define ("SDL_JOYBUTTONUP", scm_from_int (SDL_JOYBUTTONUP));
+  scm_c_define ("SDL_QUIT", scm_from_int (SDL_QUIT));
+  scm_c_define ("SDL_SYSWMEVENT", scm_from_int (SDL_SYSWMEVENT));
+  scm_c_define ("SDL_EVENT_RESERVEDA", scm_from_int (SDL_EVENT_RESERVEDA));
+  scm_c_define ("SDL_EVENT_RESERVEDB", scm_from_int (SDL_EVENT_RESERVEDB));
+  scm_c_define ("SDL_VIDEORESIZE", scm_from_int (SDL_VIDEORESIZE));
+  scm_c_define ("SDL_VIDEOEXPOSE", scm_from_int (SDL_VIDEOEXPOSE));
+  scm_c_define ("SDL_EVENT_RESERVED2", scm_from_int (SDL_EVENT_RESERVED2));
+  scm_c_define ("SDL_EVENT_RESERVED3", scm_from_int (SDL_EVENT_RESERVED3));
+  scm_c_define ("SDL_EVENT_RESERVED4", scm_from_int (SDL_EVENT_RESERVED4));
+  scm_c_define ("SDL_EVENT_RESERVED5", scm_from_int (SDL_EVENT_RESERVED5));
+  scm_c_define ("SDL_EVENT_RESERVED6", scm_from_int (SDL_EVENT_RESERVED6));
+  scm_c_define ("SDL_EVENT_RESERVED7", scm_from_int (SDL_EVENT_RESERVED7));
+  scm_c_define ("SDL_USEREVENT", scm_from_int (SDL_USEREVENT));
+  scm_c_define ("SDL_NUMEVENTS", scm_from_int (SDL_NUMEVENTS));
+
+  scm_c_define_gsubr ("SDL_Init", 1, 0, 0, gacela_SDL_Init);
+  scm_c_define_gsubr ("SDL_Quit", 0, 0, 0, gacela_SDL_Quit);
+  scm_c_define_gsubr ("SDL_SetVideoMode", 4, 0, 0, gacela_SDL_SetVideoMode);
+  scm_c_define_gsubr ("SDL_FreeSurface", 1, 0, 0, gacela_SDL_FreeSurface);
+  scm_c_define_gsubr ("SDL_WM_SetCaption", 2, 0, 0, gacela_SDL_WM_SetCaption);
+  scm_c_define_gsubr ("SDL_Flip", 1, 0, 0, gacela_SDL_Flip);
+  scm_c_define_gsubr ("SDL_Delay", 1, 0, 0, gacela_SDL_Delay);
+  scm_c_define_gsubr ("SDL_GetTicks", 0, 0, 0, gacela_SDL_GetTicks);
+  scm_c_define_gsubr ("SDL_DisplayFormat", 1, 0, 0, gacela_SDL_DisplayFormat);
+  scm_c_define_gsubr ("SDL_DisplayFormatAlpha", 1, 0, 0, gacela_SDL_DisplayFormatAlpha);
+  scm_c_define_gsubr ("SDL_MapRGB", 4, 0, 0, gacela_SDL_MapRGB);
+  scm_c_define_gsubr ("SDL_SetColorKey", 3, 0, 0, gacela_SDL_SetColorKey);
+  scm_c_define_gsubr ("SDL_SetAlpha", 3, 0, 0, gacela_SDL_SetAlpha);
+  scm_c_define_gsubr ("SDL_LoadBMP", 1, 0, 0, gacela_SDL_LoadBMP);
+  scm_c_define_gsubr ("IMG_Load", 1, 0, 0, gacela_IMG_Load);
+  scm_c_define_gsubr ("SDL_GetVideoInfo", 0, 0, 0, gacela_SDL_GetVideoInfo);
+  scm_c_define_gsubr ("SDL_GL_SetAttribute", 2, 0, 0, gacela_SDL_GL_SetAttribute);
+  scm_c_define_gsubr ("SDL_PollEvent", 0, 0, 0, gacela_SDL_PollEvent);
+  scm_c_define_gsubr ("SDL_GL_SwapBuffers", 0, 0, 0, gacela_SDL_GL_SwapBuffers);
+  scm_c_define_gsubr ("SDL_EnableKeyRepeat", 2, 0, 0, gacela_SDL_EnableKeyRepeat);
+  scm_c_define_gsubr ("zoomSurface", 4, 0, 0, gacela_zoomSurface);
+  scm_c_define_gsubr ("Mix_OpenAudio", 4, 0, 0, gacela_Mix_OpenAudio);
+  scm_c_define_gsubr ("Mix_LoadMUS", 1, 0, 0, gacela_Mix_LoadMUS);
+  scm_c_define_gsubr ("Mix_LoadWAV", 1, 0, 0, gacela_Mix_LoadWAV);
+  scm_c_define_gsubr ("Mix_PlayChannel", 3, 0, 0, gacela_Mix_PlayChannel);
+  scm_c_define_gsubr ("Mix_PlayMusic", 2, 0, 0, gacela_Mix_PlayMusic);
+  scm_c_define_gsubr ("Mix_PlayingMusic", 0, 0, 0, gacela_Mix_PlayingMusic);
+  scm_c_define_gsubr ("Mix_PausedMusic", 0, 0, 0, gacela_Mix_PausedMusic);
+  scm_c_define_gsubr ("Mix_PauseMusic", 0, 0, 0, gacela_Mix_PauseMusic);
+  scm_c_define_gsubr ("Mix_ResumeMusic", 0, 0, 0, gacela_Mix_ResumeMusic);
+  scm_c_define_gsubr ("Mix_HaltMusic", 0, 0, 0, gacela_Mix_HaltMusic);
+  scm_c_define_gsubr ("Mix_FreeMusic", 1, 0, 0, gacela_Mix_FreeMusic);
+  scm_c_define_gsubr ("Mix_FreeChunk", 1, 0, 0, gacela_Mix_FreeChunk);
+  scm_c_define_gsubr ("Mix_CloseAudio", 0, 0, 0, gacela_Mix_CloseAudio);
+}
+
+void
+gacela_sdl_init ()
+{
+  scm_c_define_module ("gacela sdl", init_gacela_sdl, NULL);
+}
diff --git a/src/sdl.scm b/src/sdl.scm
new file mode 100644 (file)
index 0000000..103c84c
--- /dev/null
@@ -0,0 +1,2 @@
+(define-module (gacela sdl))
+(load-extension "sdl" "foo_bar_init")
\ No newline at end of file