util.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: util.h,v 1.2 2003/11/05 16:47:22 meven Exp $ */
00024 #ifndef ILL_UTIL_H
00025 #define ILL_UTIL_H
00026 
00027 #include "machdefs.h"
00028 #include "config.h"
00029 
00030 #ifdef _USRDLL
00031 
00032 #ifdef QSLIB_EXPORTS
00033 #define QSLIB_INTERFACE __declspec(dllexport)
00034 #else
00035 #define QSLIB_INTERFACE __declspec(dllimport)
00036 #endif
00037 
00038 #else
00039 
00040 #define QSLIB_INTERFACE extern
00041 
00042 #endif
00043 
00044 #ifdef WIN32
00045 #define strcasecmp(s1, s2)  stricmp(s1, s2)
00046 #define strncasecmp(s1, s2, n)  strnicmp(s1, s2, n)
00047 #endif
00048 
00049 /****************************************************************************/
00050 /*                                                                          */
00051 /*  This file is part of CONCORDE                                           */
00052 /*                                                                          */
00053 /*  (c) Copyright 1995--1999 by David Applegate, Robert Bixby,              */
00054 /*  Vasek Chvatal, and William Cook                                         */
00055 /*                                                                          */
00056 /*  Permission is granted for academic research use.  For other uses,       */
00057 /*  contact the authors for licensing options.                              */
00058 /*                                                                          */
00059 /*  Use at your own risk.  We make no guarantees about the                  */
00060 /*  correctness or usefulness of this code.                                 */
00061 /*                                                                          */
00062 /****************************************************************************/
00063 
00064 /****************************************************************************/
00065 /*                                                                          */
00066 /*    EXPORTED FUNCTIONS:                                                   */
00067 /*                                                                          */
00068 /*  EGLPNUMPT_SWAP                                                          */
00069 /*  ILL_SWAP(a,b,t)                                                         */
00070 /*    swaps a and b, using t as temporary space.  a, b, and t should all    */
00071 /*    be the same type.                                                     */
00072 /*                                                                          */
00073 /*  ILL_OURABS(a)                                                           */
00074 /*    returns the absolute value of a.                                      */
00075 /*                                                                          */
00076 /****************************************************************************/
00077 typedef char ILLbool;
00078 
00079 #define FALSE 0
00080 #define TRUE  1
00081 
00082 #define ILL_SWAP(a,b,t) (((t)=(a)),((a)=(b)),((b)=(t)))
00083 #define EGLPNUM_SWAP(a,b,t) ((EGlpNumCopy(t,a)),(EGlpNumCopy(a,b)),(EGlpNumCopy(b,t)))
00084 
00085 #define ILL_OURABS(a) (((a) >= 0) ? (a) : -(a))
00086 
00087 #include "sortrus_common.h"
00088 #include "allocrus.h"
00089 #include "urandom.h"
00090 #include "zeit.h"
00091 /****************************************************************************/
00092 /*                                                                          */
00093 /*                             util.c                                       */
00094 /*                                                                          */
00095 /****************************************************************************/
00096 #define ILL_UTIL_STR(new, str) \
00097     { new = ILLutil_str(str); \
00098       if (str != NULL) { ILL_CHECKnull(new, "out of memeory"); } }
00099 
00100 extern char *ILLutil_str (
00101   const char *str);
00102 
00103    /* allocates and returns a copy of s */
00104 
00105 extern int ILLutil_array_index (
00106   char *list[],
00107   int n,
00108   const char *name);
00109 
00110    /* returns index of name in list or -1  */
00111 
00112 extern int ILLutil_index (
00113   const char *list[],
00114   const char *name);
00115 
00116    /* returns index of name in list or -1  */
00117 
00118 extern unsigned int ILLutil_nextprime (
00119   unsigned int x);
00120 
00121 extern const char *ILLutil_strchr (
00122   const char *s,
00123   int c);
00124 
00125 extern int ILLutil_strcasecmp (
00126   const char *s1,
00127   const char *s2);
00128 extern int ILLutil_strncasecmp (
00129   const char *s1,
00130   const char *s2,
00131   size_t n);
00132 
00133 
00134 extern int ILLutil_our_gcd (
00135   int a,
00136   int b),
00137   ILLutil_our_lcm (
00138   int a,
00139   int b),
00140   ILLutil_our_log2 (
00141   int a);
00142 
00143 double ILLutil_our_floor (
00144   double x),
00145   ILLutil_our_ceil (
00146   double x),
00147   ILLutil_our_frac (
00148   double x),
00149   ILLutil_norm_sqr (
00150   double *v,
00151   int len);
00152 
00153 #include "bgetopt.h"
00154 /*#include "dheaps_i.h"*/
00155 /*#include "priority.h"*/
00156 #endif /* ILL_UTIL_H */

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