Index: ChangeLog =================================================================== RCS file: /cvs/octave/ChangeLog,v retrieving revision 1.587 diff -u -u -r1.587 ChangeLog --- ChangeLog 16 Feb 2007 11:14:44 -0000 1.587 +++ ChangeLog 20 Feb 2007 09:19:19 -0000 @@ -1,3 +1,8 @@ +2007-02-20 Rafael Laboissiere + + * configure.in: Check for versions of GLPK prior to 4.15 and set + the GLPK_PRE_4_15 macro accordingly. + 2007-02-16 John W. Eaton * mkoctfile.in: Use OCTAVE_PREFIX, not OCTAVE_CONF_PREFIX, in sed Index: configure.in =================================================================== RCS file: /cvs/octave/configure.in,v retrieving revision 1.555 diff -u -u -r1.555 configure.in --- configure.in 8 Feb 2007 20:06:55 -0000 1.555 +++ configure.in 20 Feb 2007 09:19:19 -0000 @@ -590,7 +590,9 @@ GLPK_LIBS= if test -n "$glpk_lib"; then - AC_CHECK_LIB($glpk_lib, glp_lpx_simplex, [GLPK_LIBS="-l$glpk_lib"], [ + AC_CHECK_LIB($glpk_lib, glp_lpx_simplex, [ + GLPK_LIBS="-l$glpk_lib" + AC_DEFINE(GLPK_PRE_4_15, 1, [Define if GLPK version is less than 4.15.])], [ AC_CHECK_LIB($glpk_lib, _glp_lpx_simplex, [GLPK_LIBS="-l$glpk_lib"], [])]) if test -n "$GLPK_LIBS"; then AC_CHECK_HEADERS(glpk.h, [ Index: scripts/ChangeLog =================================================================== RCS file: /cvs/octave/scripts/ChangeLog,v retrieving revision 1.711 diff -u -u -r1.711 ChangeLog --- scripts/ChangeLog 20 Feb 2007 02:20:40 -0000 1.711 +++ scripts/ChangeLog 20 Feb 2007 09:19:23 -0000 @@ -1,3 +1,8 @@ +2007-02-20 Rafael Laboissiere + + * optimization/glpk.m: Document the fact that extra.mem does not work + for versions of GLPK 4.15 and later. + 2007-02-19 John W. Eaton * plot/__uiobject_alloc__.in: If next available element in Index: scripts/optimization/glpk.m =================================================================== RCS file: /cvs/octave/scripts/optimization/glpk.m,v retrieving revision 1.8 diff -u -u -r1.8 glpk.m --- scripts/optimization/glpk.m 22 Jan 2007 17:29:53 -0000 1.8 +++ scripts/optimization/glpk.m 20 Feb 2007 09:19:23 -0000 @@ -361,7 +361,8 @@ ## @item time ## Time (in seconds) used for solving LP/MIP problem. ## @item mem -## Memory (in bytes) used for solving LP/MIP problem. +## Memory (in bytes) used for solving LP/MIP problem (this is not +## available if the version of GLPK is 4.15 or later) ## @end table ## @end table ## Index: src/ChangeLog =================================================================== RCS file: /cvs/octave/src/ChangeLog,v retrieving revision 1.1645 diff -u -u -r1.1645 ChangeLog --- src/ChangeLog 17 Feb 2007 14:49:34 -0000 1.1645 +++ src/ChangeLog 20 Feb 2007 09:19:31 -0000 @@ -1,3 +1,8 @@ +2007-02-20 Rafael Laboissiere + + * DLD-FUNCTIONS/__glpk__.cc: Adapt code for changes in the GLPK + API for version 4.15 or later. + 2007-02-17 John W. Eaton * variables.cc (symbol_out_of_date): Don't exit early if looking Index: src/DLD-FUNCTIONS/__glpk__.cc =================================================================== RCS file: /cvs/octave/src/DLD-FUNCTIONS/__glpk__.cc,v retrieving revision 1.18 diff -u -u -r1.18 __glpk__.cc --- src/DLD-FUNCTIONS/__glpk__.cc 8 Feb 2007 19:08:34 -0000 1.18 +++ src/DLD-FUNCTIONS/__glpk__.cc 20 Feb 2007 09:19:31 -0000 @@ -40,6 +40,9 @@ extern "C" { #include + +#ifdef GLPK_PRE_4_15 + #ifndef _GLPLIB_H #include #endif @@ -49,6 +52,15 @@ #ifndef lib_set_print_hook #define lib_set_print_hook lib_print_hook #endif + +#else + +extern "C" { +void _glp_lib_print_hook(int (*func)(void *info, char *buf), void *info); +void _glp_lib_fault_hook(int (*func)(void *info, char *buf), void *info); +} + +#endif } #define NIntP 17 @@ -150,10 +162,18 @@ clock_t t_start = clock(); +#ifdef GLPK_PRE_4_15 lib_set_fault_hook (NULL, glpk_fault_hook); +#else + _glp_lib_fault_hook (glpk_fault_hook, NULL); +#endif if (lpxIntParam[0] > 1) +#ifdef GLPK_PRE_4_15 lib_set_print_hook (NULL, glpk_print_hook); +#else + _glp_lib_print_hook (glpk_print_hook, NULL); +#endif LPX *lp = lpx_create_prob (); @@ -286,7 +306,11 @@ break; default: +#ifdef GLPK_PRE_4_15 insist (method != method); +#else + glpk_fault_hook (NULL, "method != method"); +#endif } /* errnum assumes the following results: @@ -351,7 +375,12 @@ } *time = (clock () - t_start) / CLOCKS_PER_SEC; + +#ifdef GLPK_PRE_4_15 *mem = (lib_env_ptr () -> mem_tpeak); +#else + *mem = 0; +#endif lpx_delete_prob (lp); return 0;