dbl_format.h

Go to the documentation of this file.
00001 /****************************************************************************/
00002 /*                                                                          */
00003 /*  This file is part of QSopt_ex.                                          */
00004 /*                                                                          */
00005 /*  (c) Copyright 2006 by David Applegate, William Cook, Sanjeeb Dash,      */
00006 /*  and Daniel Espinoza                                                     */
00007 /*                                                                          */
00008 /*  Sanjeeb Dash ownership of copyright in QSopt_ex is derived from his     */
00009 /*  copyright in QSopt.                                                     */
00010 /*                                                                          */
00011 /*  This code may be used under the terms of the GNU General Public License */
00012 /*  (Version 2.1 or later) as published by the Free Software Foundation.    */
00013 /*                                                                          */
00014 /*  Alternatively, use is granted for research purposes only.               */
00015 /*                                                                          */
00016 /*  It is your choice of which of these two licenses you are operating      */
00017 /*  under.                                                                  */
00018 /*                                                                          */
00019 /*  We make no guarantees about the correctness or usefulness of this code. */
00020 /*                                                                          */
00021 /****************************************************************************/
00022 
00023 /* RCSINFO $Id: dbl_format.h,v 1.3 2003/11/05 16:59:48 meven Exp $ */
00024 #ifndef dbl_QS_FORMAT_ERROR_H
00025 #define dbl_QS_FORMAT_ERROR_H
00026 
00027 #include <stdio.h>
00028 #include "dbl_qsopt.h"
00029 
00030 /****************************************************************************/
00031 /*
00032    The LP/MPS readers, writers, 
00033        dbl_ILLrawlpdata_to_lpdata, and 
00034    use dbl_ILLformat_error to report problems with their input iff
00035        the line reader used in reading the problem  or 
00036        the  dbl_qserror_collector pointer passed to dbl_ILLwrite_lp_file
00037    is not NULL.
00038 
00039    The QSgui code uses this feature to collect dbl_qsformat_error instances 
00040    which it uses after reading is done to insert error messages into the 
00041    input window. 
00042 */
00043 /****************************************************************************/
00044 
00045 /* 
00046 for error type USE: 
00047           QS_DATA_ERROR     
00048           QS_DATA_WARN      
00049           QS_MPS_FORMAT_ERROR   
00050           QS_MPS_FORMAT_WARN    
00051           QS_LP_FORMAT_ERROR    
00052           QS_LP_FORMAT_WARN   
00053           QS_LP_OBJ_WARN      
00054           QS_GENERIC_ERROR    
00055 */
00056 
00057 typedef struct dbl_qsformat_error
00058 {
00059   char *desc;
00060   char *theLine;
00061   struct dbl_qsformat_error *next;
00062   int type;
00063   int lineNumber;               /* 1 based line counting */
00064   int at;
00065 }
00066 dbl_qsformat_error;
00067 
00068 extern int dbl_ILLformat_error_create (
00069   dbl_qsformat_error * error,
00070   int mode,
00071   const char *desc,
00072   int lineNum,
00073   const char *theLine,
00074   int atPos);
00075 extern void dbl_ILLformat_error_delete (
00076   dbl_qsformat_error * error);
00077 
00078 extern void dbl_ILLformat_error_print (
00079   FILE * out,
00080   dbl_qsformat_error * e);
00081 
00082 
00083 
00084 /*****************************************************************************
00085  * collecting error messages 
00086  * either with defining own qsad_error_fct and corresponding data structure 
00087  * or by using predefined dbl_ILLadd_error_to_memory fct with dbl_qserror_memory
00088  */
00089 
00090 typedef int (
00091   *dbl_qsadd_error_fct) (
00092   void *dest,
00093   const dbl_qsformat_error * error);
00094 
00095 typedef struct dbl_qserror_collector
00096 {
00097   dbl_qsadd_error_fct add_error;
00098   void *dest;
00099 }
00100 dbl_qserror_collector;
00101 
00102 typedef struct dbl_qserror_memory
00103 {
00104   unsigned int nerror;
00105   dbl_qsformat_error *error_list;
00106   char has_error[QS_INPUT_NERROR];
00107   char hasErrorLines;
00108 }
00109 dbl_qserror_memory;
00110 
00111 
00112 extern dbl_qserror_collector *dbl_ILLerror_collector_new (
00113   dbl_qsadd_error_fct fct,
00114   void *dest);
00115 
00116 dbl_qserror_collector *dbl_ILLerror_memory_collector_new (
00117   dbl_qserror_memory * dest);
00118 
00119 extern void dbl_ILLerror_collector_free (
00120   dbl_qserror_collector * c);
00121 
00122 #define dbl_ILLformat_error(collector, error)  \
00123   ((collector)->add_error((collector)->dest, error))
00124 
00125 
00126 extern int dbl_ILLadd_error_to_memory (
00127   void *dest,
00128   const dbl_qsformat_error * error);
00129 
00130 extern dbl_qserror_memory *dbl_ILLerror_memory_create (
00131   int takeErrorLines);
00132 extern void dbl_ILLerror_memory_free (
00133   dbl_qserror_memory * mem);
00134 
00135 #endif

Generated on Wed Apr 22 09:16:09 2009 for QSopt_ex by  doxygen 1.5.2