/usr/include/ug/misc.h is in libdune-uggrid-dev 2.5.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
/****************************************************************************/
/* */
/* File: misc.h */
/* */
/* Purpose: header for misc.c */
/* */
/* Author: Henrik Rentz-Reichert */
/* Institut fuer Computeranwendungen */
/* Universitaet Stuttgart */
/* Pfaffenwaldring 27 */
/* 70569 Stuttgart */
/* internet: ug@ica3.uni-stuttgart.de */
/* */
/* History: 23.02.95 ug3-version */
/* */
/* Revision: 07.09.95 */
/* */
/****************************************************************************/
/****************************************************************************/
/* */
/* auto include mechanism and other include files */
/* */
/****************************************************************************/
#ifndef __MISC__
#define __MISC__
#include "ugtypes.h"
#include <cstring>
#include "heaps.h"
#include "namespace.h"
START_UG_NAMESPACE
/****************************************************************************/
/* */
/* defines in the following order */
/* */
/* compile time constants defining static data size (i.e. arrays) */
/* other constants */
/* macros */
/* */
/****************************************************************************/
#ifndef PI
#define PI 3.141592653589793238462643383279
#endif
#define KBYTE 1024
#define MBYTE (KBYTE*KBYTE)
#define GBYTE (KBYTE*KBYTE*KBYTE)
/* cleanup old definitions of macros */
#ifdef MIN
#undef MIN
#endif
#ifdef MAX
#undef MAX
#endif
#ifdef ABS
#undef ABS
#endif
#define ABS(i) (((i)<0) ? (-(i)) : (i))
#define MIN(x,y) (((x)<(y)) ? (x) : (y))
#define MAX(x,y) (((x)>(y)) ? (x) : (y))
#define POW2(i) (1<<(i))
#define ABSDIFF(a,b) (fabs((a)-(b)))
#define SIGNUM(x) (((x)>0) ? 1 : ((x)<0) ? -1 : 0)
#define FSIGNUM(x) (((x)>SMALL_F) ? 1 : ((x)<-SMALL_F) ? -1 : 0)
#define DSIGNUM(x) (((x)>SMALL_D) ? 1 : ((x)<-SMALL_D) ? -1 : 0)
#define EVEN(i) (!(i%2))
#define ODD(i) ((i%2))
#define SWAP(a,b,temp) {(temp) = (a); (a) = (b); (b) = (temp);}
#define QUOT(i,j) ((double)(i))/((double)(j))
#define SET_FLAG(flag,bitpattern) (flag |= (bitpattern))
#define CLEAR_FLAG(flag,bitpattern) (flag &= ~(bitpattern))
#define READ_FLAG(flag,bitpattern) ((flag & (bitpattern))>0)
#define HiWrd(aLong) (((aLong) >> 16) & 0xFFFF)
#define LoWrd(aLong) ((aLong) & 0xFFFF)
#define SetHiWrd(aLong,n) aLong = (((n)&0xFFFF)<<16)|((aLong)&0xFFFF)
#define SetLoWrd(aLong,n) aLong = ((n)&0xFFFF)|((aLong)&0xFFFF0000)
/* concatenation macros with one level of indirection to allow argument expansion */
#define CONCAT3(a,b,c) CONCAT3_AUX(a,b,c)
#define CONCAT3_AUX(a,b,c) a b c
#define CONCAT4(a,b,c,d) CONCAT4_AUX(a,b,c,d)
#define CONCAT4_AUX(a,b,c,d) a b c d
#define CONCAT5(a,b,c,d,e) CONCAT5_AUX(a,b,c,d,e)
#define CONCAT5_AUX(a,b,c,d,e) a b c d e
/* concatenation macros for preprocessor */
#define XCAT(a,b) a ## b
#define XCAT3(a,b,c) a ## b ## c
#define CAT(a,b) XCAT(a,b)
#define CAT3(a,b,c) XCAT3(a,b,c)
/* expand macro and transfer expanded to string */
#define XSTR(s) # s
#define STR(s) XSTR(s)
#ifndef YES
#define YES 1
#endif
#define ON 1
#ifndef NO
#define NO 0
#endif
#define OFF 0
#define BOOL_2_YN(b) ((b) ? "YES" : "NO")
#define BOOL_2_TF(b) ((b) ? "true" : "false")
#define BOOL_2_NF(b) ((b) ? "ON" : "OFF")
/* switching by strings */
#define STR_SWITCH(str) if (1) {const char *StrPtr=str; if (0) StrPtr=str; /* dummy 'if' to admit 'else if' for cases */
#define STR_CASE(opt) else if (strncmp(StrPtr,opt,strlen(opt))==0) {
#define STR_BREAK }
#define STR_DEFAULT else {
#define STR_SWITCH_END }
/****************************************************************************/
/* */
/* definition of exported global variables */
/* */
/****************************************************************************/
extern int UG_math_error;
#ifndef ModelP
END_UG_NAMESPACE
namespace PPIF {
extern int me; /* to have in the serial case this variable as a dummy */
extern int master; /* to have in the serial case this variable as a dummy */
extern int procs; /* to have in the serial case this variable as a dummy */
} /* end namespace PPIF */
START_UG_NAMESPACE
extern int _proclist_; /* to have in the serial case this variable as a dummy*/
extern int _partition_; /* to have in the serial case this variable as a dummy*/
#endif
/****************************************************************************/
/* */
/* function declarations */
/* */
/****************************************************************************/
/* general routines */
void INT_2_bitpattern (INT n, char text[33]);
INT CenterInPattern (char *str, INT PatLen, const char *text, char p, const char *end);
char *StrTok (char *s, const char *ct);
char *expandfmt (const char *fmt);
char *ExpandCShellVars (char *string);
const char *strntok (const char *str, const char *sep, int n, char *token);
char *StrDup (const char *s);
void QSort (void *base, INT n, INT size, int (*cmp)(const void *, const void *));
void SelectionSort (void *base, INT n, INT size, int (*cmp)(const void *, const void *));
char *ExpandCShellVars (char *string);
INT ReadMemSizeFromString (const char *s, MEM *mem_size);
INT WriteMemSizeToString (MEM mem_size, char *s);
END_UG_NAMESPACE
#endif
|