lemon-project-template-glpk

annotate deps/glpk/src/glpenv.h @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
rev   line source
alpar@9 1 /* glpenv.h (GLPK environment) */
alpar@9 2
alpar@9 3 /***********************************************************************
alpar@9 4 * This code is part of GLPK (GNU Linear Programming Kit).
alpar@9 5 *
alpar@9 6 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
alpar@9 7 * 2009, 2010, 2011 Andrew Makhorin, Department for Applied Informatics,
alpar@9 8 * Moscow Aviation Institute, Moscow, Russia. All rights reserved.
alpar@9 9 * E-mail: <mao@gnu.org>.
alpar@9 10 *
alpar@9 11 * GLPK is free software: you can redistribute it and/or modify it
alpar@9 12 * under the terms of the GNU General Public License as published by
alpar@9 13 * the Free Software Foundation, either version 3 of the License, or
alpar@9 14 * (at your option) any later version.
alpar@9 15 *
alpar@9 16 * GLPK is distributed in the hope that it will be useful, but WITHOUT
alpar@9 17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
alpar@9 18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
alpar@9 19 * License for more details.
alpar@9 20 *
alpar@9 21 * You should have received a copy of the GNU General Public License
alpar@9 22 * along with GLPK. If not, see <http://www.gnu.org/licenses/>.
alpar@9 23 ***********************************************************************/
alpar@9 24
alpar@9 25 #ifndef GLPENV_H
alpar@9 26 #define GLPENV_H
alpar@9 27
alpar@9 28 #include "glpstd.h"
alpar@9 29 #include "glplib.h"
alpar@9 30
alpar@9 31 typedef struct ENV ENV;
alpar@9 32 typedef struct MEM MEM;
alpar@9 33 typedef struct XFILE XFILE;
alpar@9 34
alpar@9 35 #define ENV_MAGIC 0x454E5631
alpar@9 36 /* environment block magic value */
alpar@9 37
alpar@9 38 #define TERM_BUF_SIZE 4096
alpar@9 39 /* terminal output buffer size, in bytes */
alpar@9 40
alpar@9 41 #define IOERR_MSG_SIZE 1024
alpar@9 42 /* i/o error message buffer size, in bytes */
alpar@9 43
alpar@9 44 #define MEM_MAGIC 0x4D454D31
alpar@9 45 /* memory block descriptor magic value */
alpar@9 46
alpar@9 47 struct ENV
alpar@9 48 { /* environment block */
alpar@9 49 int magic;
alpar@9 50 /* magic value used for debugging */
alpar@9 51 char version[7+1];
alpar@9 52 /* version string returned by the routine glp_version */
alpar@9 53 /*--------------------------------------------------------------*/
alpar@9 54 /* terminal output */
alpar@9 55 char *term_buf; /* char term_buf[TERM_BUF_SIZE]; */
alpar@9 56 /* terminal output buffer */
alpar@9 57 int term_out;
alpar@9 58 /* flag to enable/disable terminal output */
alpar@9 59 int (*term_hook)(void *info, const char *s);
alpar@9 60 /* user-defined routine to intercept terminal output */
alpar@9 61 void *term_info;
alpar@9 62 /* transit pointer (cookie) passed to the routine term_hook */
alpar@9 63 FILE *tee_file;
alpar@9 64 /* output stream used to copy terminal output */
alpar@9 65 /*--------------------------------------------------------------*/
alpar@9 66 /* error handling */
alpar@9 67 const char *err_file;
alpar@9 68 /* value of the __FILE__ macro passed to glp_error */
alpar@9 69 int err_line;
alpar@9 70 /* value of the __LINE__ macro passed to glp_error */
alpar@9 71 void (*err_hook)(void *info);
alpar@9 72 /* user-defined routine to intercept abnormal termination */
alpar@9 73 void *err_info;
alpar@9 74 /* transit pointer (cookie) passed to the routine err_hook */
alpar@9 75 /*--------------------------------------------------------------*/
alpar@9 76 /* memory allocation */
alpar@9 77 glp_long mem_limit;
alpar@9 78 /* maximal amount of memory (in bytes) available for dynamic
alpar@9 79 allocation */
alpar@9 80 MEM *mem_ptr;
alpar@9 81 /* pointer to the linked list of allocated memory blocks */
alpar@9 82 int mem_count;
alpar@9 83 /* total number of currently allocated memory blocks */
alpar@9 84 int mem_cpeak;
alpar@9 85 /* peak value of mem_count */
alpar@9 86 glp_long mem_total;
alpar@9 87 /* total amount of currently allocated memory (in bytes; is the
alpar@9 88 sum of the size field over all memory block descriptors) */
alpar@9 89 glp_long mem_tpeak;
alpar@9 90 /* peak value of mem_total */
alpar@9 91 /*--------------------------------------------------------------*/
alpar@9 92 /* stream input/output */
alpar@9 93 XFILE *file_ptr;
alpar@9 94 /* pointer to the linked list of active stream descriptors */
alpar@9 95 char *ioerr_msg; /* char ioerr_msg[IOERR_MSG_SIZE]; */
alpar@9 96 /* input/output error message buffer */
alpar@9 97 /*--------------------------------------------------------------*/
alpar@9 98 /* shared libraries support */
alpar@9 99 void *h_odbc;
alpar@9 100 /* handle to ODBC shared library */
alpar@9 101 void *h_mysql;
alpar@9 102 /* handle to MySQL shared library */
alpar@9 103 };
alpar@9 104
alpar@9 105 struct MEM
alpar@9 106 { /* memory block descriptor */
alpar@9 107 int flag;
alpar@9 108 /* descriptor flag */
alpar@9 109 int size;
alpar@9 110 /* size of block (in bytes, including descriptor) */
alpar@9 111 MEM *prev;
alpar@9 112 /* pointer to previous memory block descriptor */
alpar@9 113 MEM *next;
alpar@9 114 /* pointer to next memory block descriptor */
alpar@9 115 };
alpar@9 116
alpar@9 117 struct XFILE
alpar@9 118 { /* input/output stream descriptor */
alpar@9 119 int type;
alpar@9 120 /* stream handle type: */
alpar@9 121 #define FH_FILE 0x11 /* FILE */
alpar@9 122 #define FH_ZLIB 0x22 /* gzFile */
alpar@9 123 void *fh;
alpar@9 124 /* pointer to stream handle */
alpar@9 125 XFILE *prev;
alpar@9 126 /* pointer to previous stream descriptor */
alpar@9 127 XFILE *next;
alpar@9 128 /* pointer to next stream descriptor */
alpar@9 129 };
alpar@9 130
alpar@9 131 #define XEOF (-1)
alpar@9 132
alpar@9 133 #define get_env_ptr _glp_get_env_ptr
alpar@9 134 ENV *get_env_ptr(void);
alpar@9 135 /* retrieve pointer to environment block */
alpar@9 136
alpar@9 137 #define tls_set_ptr _glp_tls_set_ptr
alpar@9 138 void tls_set_ptr(void *ptr);
alpar@9 139 /* store global pointer in TLS */
alpar@9 140
alpar@9 141 #define tls_get_ptr _glp_tls_get_ptr
alpar@9 142 void *tls_get_ptr(void);
alpar@9 143 /* retrieve global pointer from TLS */
alpar@9 144
alpar@9 145 #define xprintf glp_printf
alpar@9 146 void glp_printf(const char *fmt, ...);
alpar@9 147 /* write formatted output to the terminal */
alpar@9 148
alpar@9 149 #define xvprintf glp_vprintf
alpar@9 150 void glp_vprintf(const char *fmt, va_list arg);
alpar@9 151 /* write formatted output to the terminal */
alpar@9 152
alpar@9 153 #ifndef GLP_ERROR_DEFINED
alpar@9 154 #define GLP_ERROR_DEFINED
alpar@9 155 typedef void (*_glp_error)(const char *fmt, ...);
alpar@9 156 #endif
alpar@9 157
alpar@9 158 #define xerror glp_error_(__FILE__, __LINE__)
alpar@9 159 _glp_error glp_error_(const char *file, int line);
alpar@9 160 /* display error message and terminate execution */
alpar@9 161
alpar@9 162 #define xassert(expr) \
alpar@9 163 ((void)((expr) || (glp_assert_(#expr, __FILE__, __LINE__), 1)))
alpar@9 164 void glp_assert_(const char *expr, const char *file, int line);
alpar@9 165 /* check for logical condition */
alpar@9 166
alpar@9 167 #define xmalloc glp_malloc
alpar@9 168 void *glp_malloc(int size);
alpar@9 169 /* allocate memory block */
alpar@9 170
alpar@9 171 #define xcalloc glp_calloc
alpar@9 172 void *glp_calloc(int n, int size);
alpar@9 173 /* allocate memory block */
alpar@9 174
alpar@9 175 #define xfree glp_free
alpar@9 176 void glp_free(void *ptr);
alpar@9 177 /* free memory block */
alpar@9 178
alpar@9 179 #define xtime glp_time
alpar@9 180 glp_long glp_time(void);
alpar@9 181 /* determine current universal time */
alpar@9 182
alpar@9 183 #define xdifftime glp_difftime
alpar@9 184 double glp_difftime(glp_long t1, glp_long t0);
alpar@9 185 /* compute difference between two time values, in seconds */
alpar@9 186
alpar@9 187 #define lib_err_msg _glp_lib_err_msg
alpar@9 188 void lib_err_msg(const char *msg);
alpar@9 189
alpar@9 190 #define xerrmsg _glp_lib_xerrmsg
alpar@9 191 const char *xerrmsg(void);
alpar@9 192
alpar@9 193 #define xfopen _glp_lib_xfopen
alpar@9 194 XFILE *xfopen(const char *fname, const char *mode);
alpar@9 195
alpar@9 196 #define xferror _glp_lib_xferror
alpar@9 197 int xferror(XFILE *file);
alpar@9 198
alpar@9 199 #define xfeof _glp_lib_xfeof
alpar@9 200 int xfeof(XFILE *file);
alpar@9 201
alpar@9 202 #define xfgetc _glp_lib_xfgetc
alpar@9 203 int xfgetc(XFILE *file);
alpar@9 204
alpar@9 205 #define xfputc _glp_lib_xfputc
alpar@9 206 int xfputc(int c, XFILE *file);
alpar@9 207
alpar@9 208 #define xfflush _glp_lib_xfflush
alpar@9 209 int xfflush(XFILE *fp);
alpar@9 210
alpar@9 211 #define xfclose _glp_lib_xfclose
alpar@9 212 int xfclose(XFILE *file);
alpar@9 213
alpar@9 214 #define xfprintf _glp_lib_xfprintf
alpar@9 215 int xfprintf(XFILE *file, const char *fmt, ...);
alpar@9 216
alpar@9 217 #define xdlopen _glp_xdlopen
alpar@9 218 void *xdlopen(const char *module);
alpar@9 219
alpar@9 220 #define xdlsym _glp_xdlsym
alpar@9 221 void *xdlsym(void *h, const char *symbol);
alpar@9 222
alpar@9 223 #define xdlclose _glp_xdlclose
alpar@9 224 void xdlclose(void *h);
alpar@9 225
alpar@9 226 #endif
alpar@9 227
alpar@9 228 /* eof */