|
From: | Jeroen Demeyer |
Subject: | Re: [Help-glpk] [PATCH] determine whether we are handling an error |
Date: | Thu, 05 Nov 2015 22:57:50 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 2015-11-05 22:20, Heinrich Schuchardt wrote:
Hello Jeroen, could you, please, describe the use case for the patch.
My use case is really for using GLPK through SageMath, which is a mathematical program with an interactive Python interface. I want to convert GLPK errors to Python exceptions. For this I install an error hook and a term hook. But I need to distinguish between normal messages and error messages.
Currently both normal messages and error messages are sent to stdout, which does not match usual usage of output streams. I propose to store the information if an error message is written in env->term_out and to use a new value GLP_ERROR = 2 to indicate an error message. This value then should be used in glp_puts to decide if a message shall be sent to stdout or stderr. An API function could be provided to read env->term_out. The return value could be used in the terminal hook function.
Sure, I don't really care so much *how* this feature is added. I implemented it the way I did mainly because it was the simplest solution.
Jeroen.
[Prev in Thread] | Current Thread | [Next in Thread] |