ldbl_format.h

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

Generated on Thu Mar 29 09:32:31 2012 for QSopt_ex by  doxygen 1.4.7