Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Rename glp_have_error -> glp_at_error
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Nov 6, 2015
1 parent f312818 commit 18265ee
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions build/pkgs/glpk/patches/have_error.patch
@@ -1,4 +1,4 @@
Add a function glp_have_error() to check whether we are currently
Add a function glp_at_error() to check whether we are currently
handling an error message.

diff -ru glpk-4.55/doc/glpk06.tex glpk-4.55-patched//doc/glpk06.tex
Expand All @@ -13,12 +13,12 @@ diff -ru glpk-4.55/doc/glpk06.tex glpk-4.55-patched//doc/glpk06.tex
+\synopsis
+
+\begin{verbatim}
+ int glp_have_error(void);
+ int glp_at_error(void);
+\end{verbatim}
+
+\description
+
+The routine \verb|glp_have_error| returns 0 in normal operation and 1
+The routine \verb|glp_at_error| returns 0 in normal operation and 1
+if GLPK is currently handling an error.
+
+This can be used by a custom output handler (installed with
Expand All @@ -35,7 +35,7 @@ diff -ru glpk-4.55/src/env/env.h glpk-4.55-patched//src/env/env.h
void glp_error_hook(void (*func)(void *info), void *info);
/* install hook to intercept abnormal termination */

+int glp_have_error(void);
+int glp_at_error(void);
+/* are we currently handling an error? */
+
#define put_err_msg _glp_put_err_msg
Expand All @@ -58,21 +58,21 @@ diff -ru glpk-4.55/src/env/error.c glpk-4.55-patched//src/env/error.c
/***********************************************************************
+* NAME
+*
+* glp_have_error - are we currently handling an error?
+* glp_at_error - are we currently handling an error?
+*
+* SYNOPSIS
+*
+* int glp_have_error(void);
+* int glp_at_error(void);
+*
+* DESCRIPTION
+*
+* The routine glp_have_error returns 0 in normal operation and 1 if
+* The routine glp_at_error returns 0 in normal operation and 1 if
+* GLPK is currently handling an error.
+*
+* This can be used by a term hook to determine whether or not the
+* message to be displayed is an error message. */
+
+int glp_have_error(void)
+int glp_at_error(void)
+{ ENV *env = get_env_ptr();
+ return env->err_file != NULL;
+}
Expand All @@ -88,7 +88,7 @@ diff -ru glpk-4.55/src/glpk.h glpk-4.55-patched//src/glpk.h
void glp_error_hook(void (*func)(void *info), void *info);
/* install hook to intercept abnormal termination */

+int glp_have_error(void);
+int glp_at_error(void);
+/* are we currently handling an error? */
+
#define glp_malloc(size) glp_alloc(1, size)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/libs/glpk/env.pxd
Expand Up @@ -6,6 +6,6 @@ cdef extern from "glpk.h":
int glp_open_tee(const char *fname)
int glp_close_tee()
void glp_error_hook(void (*func)(void *info), void *info)
int glp_have_error()
int glp_at_error()
void glp_mem_limit(int limit)
void glp_mem_usage(int *count, int *cpeak, size_t *total, size_t *tpeak)
2 changes: 1 addition & 1 deletion src/sage/libs/glpk/error.pyx
Expand Up @@ -41,7 +41,7 @@ cdef int sage_glpk_term_hook(void *info, const char *s) with gil:
A hook to intercept all output written by GLPK.
"""
global error_message
if glp_have_error():
if glp_at_error():
# Save error message and skip normal printing
error_message += s
return 1
Expand Down

0 comments on commit 18265ee

Please sign in to comment.