[Tux4kids-commits] r1700 - branches/commonification/t4kcommon/trunk/src tuxmath/trunk tuxmath/trunk/src

David Bruce dbruce-guest at alioth.debian.org
Mon Dec 28 01:40:56 UTC 2009


Author: dbruce-guest
Date: 2009-12-28 01:40:56 +0000 (Mon, 28 Dec 2009)
New Revision: 1700

Modified:
   branches/commonification/t4kcommon/trunk/src/t4k-menu.c
   tuxmath/trunk/configure.ac
   tuxmath/trunk/src/Makefile.am
   tuxmath/trunk/src/game.c
Log:
Fix of undefined max() and min() in t4k-menu.c

Also, tuxmath's configure.ac now has option to link to libt4kcommon that
is turned off by default

Modified: branches/commonification/t4kcommon/trunk/src/t4k-menu.c
===================================================================
--- branches/commonification/t4kcommon/trunk/src/t4k-menu.c	2009-12-27 20:14:33 UTC (rev 1699)
+++ branches/commonification/t4kcommon/trunk/src/t4k-menu.c	2009-12-28 01:40:56 UTC (rev 1700)
@@ -135,8 +135,9 @@
 int             find_longest_menu_page(MenuNode* menu);
 void            set_font_size();
 void            prerender_menu(MenuNode* menu);
+int		min(int a, int b);
+int		max(int a, int b);
 
-
 /*
   functions initializing the menu module
   (they shoul be called before any other menu activity)
@@ -1144,3 +1145,19 @@
       PrerenderMenu(i);
 }
 
+int min(int a, int b)
+{
+  if(a < b) return a;
+  else return b;
+}
+
+int max(int a, int b)
+{
+  if(a > b) return a;
+  else return b;
+}
+
+
+
+
+

Modified: tuxmath/trunk/configure.ac
===================================================================
--- tuxmath/trunk/configure.ac	2009-12-27 20:14:33 UTC (rev 1699)
+++ tuxmath/trunk/configure.ac	2009-12-28 01:40:56 UTC (rev 1700)
@@ -26,6 +26,8 @@
 AM_GNU_GETTEXT
 #AM_GNU_GETTEXT_INTL_SUBDIR
 
+dnl For libtool support to link libt4k-common:
+LT_INIT
 
 # ----------------------------------------------------------------------
 # Checks for programs.
@@ -38,7 +40,7 @@
 AC_PROG_AWK
 AC_PROG_CPP
 AC_PROG_MKDIR_P
-AC_PROG_RANLIB
+#AC_PROG_RANLIB
 AC_PROG_YACC
 
 
@@ -173,6 +175,24 @@
   AC_DEFINE([HAVE_RSVG],[1],[Define to 1 if you have the `libRSVG` library])
 fi
 
+
+dnl Use of libt4kcommon is disabled for now by default 
+dnl but can be enabled at configure time for testing and development.
+
+AC_ARG_WITH([libt4kcommon],
+            [AS_HELP_STRING([--with-libt4kcommon],[use libtk4common if available])],
+            [with_libt4kcommon=yes],
+            [with_libt4kcommon=no])
+
+if test "x$with_libt4kcommon" != xno; then
+AC_CHECK_LIB([t4kcommon],
+             [InitT4KCommon],
+             ,
+             [with_libt4kcommon=no;
+              AC_MSG_FAILURE([libt4kcommon test failed (--without-libt4kcommon to disable use of libt4kcommon)])])
+fi
+
+
 dnl Check for (somewhat) higher-level math functions - needed for SDL_extras
 dnl AC_CHECK_LIB([m],
 dnl              [csin],

Modified: tuxmath/trunk/src/Makefile.am
===================================================================
--- tuxmath/trunk/src/Makefile.am	2009-12-27 20:14:33 UTC (rev 1699)
+++ tuxmath/trunk/src/Makefile.am	2009-12-28 01:40:56 UTC (rev 1700)
@@ -15,9 +15,6 @@
 LDADD = @LIBINTL@ \
   ../linebreak/liblinebreak.a
 
-
-
-
 if BUILD_MINGW32
   bin_PROGRAMS = TuxMath tuxmathserver
   DATA_PREFIX=@MINGW32_PACKAGE_DATA_DIR@
@@ -64,25 +61,35 @@
 # HACK "TuxMath" is the Windows program, whereas "tuxmath" is the Unix program
 TuxMath_SOURCES  = $(tuxmath_SOURCES) tuxmathrc.rc
 
+
+# NOTE - the "extra" programs built here don't need the same linking,
+# so they have their own prog_LDADD statements to override the
+# global LDADD flag.
+
 tuxmathadmin_SOURCES = tuxmathadmin.c
+tuxmathadmin_LDADD = @LIBINTL@
 
 generate_lesson_SOURCES = generate_lesson.c	\
 		mathcards.c	\
 		options.c	\
 		fileops.c	\
 		lessons.c
+generate_lesson_LDADD =
 
+
 tuxmathserver_SOURCES = servermain.c	\
 		server.c \
 		mathcards.c	\
 		throttle.c	\
 		options.c
+tuxmathserver_LDADD = @LIBINTL@
 
 tuxmathtestclient_SOURCES = testclient.c \
                             throttle.c \
                             network.c  \
                             options.c  \
                             mathcards.c
+tuxmathtestclient_LDADD =
 
 EXTRA_DIST = 	credits.h 	\
 	factoroids.h	\

Modified: tuxmath/trunk/src/game.c
===================================================================
--- tuxmath/trunk/src/game.c	2009-12-27 20:14:33 UTC (rev 1699)
+++ tuxmath/trunk/src/game.c	2009-12-28 01:40:56 UTC (rev 1700)
@@ -523,7 +523,7 @@
 
   if(strncmp(buf, "PLAYER_MSG", strlen("PLAYER_MSG")) == 0)
   {
-    printf("buf is %s\n", buf);                                                  
+    DEBUGMSG(debug_lan, "buf is %s\n", buf);                                                  
   }
 
   else if(strncmp(buf, "ADD_QUESTION", strlen("ADD_QUESTION")) == 0)
@@ -759,10 +759,12 @@
   for (i = 0; i < Opts_MaxComets(); i++)
   {
     if (comets[i].flashcard.question_id == id)
-     {printf("the question id is in slot %d\n",i);
-      return &comets[i];}
+    {
+      DEBUGMSG(debug_lan, "the question id is in slot %d\n", i);
+      return &comets[i];
+    }
   }
-
+  // Didn't find it:
   return NULL;
 }
 




More information about the Tux4kids-commits mailing list