| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 5 |
/****************************************************************************/ |
| 6 |
/* */ |
| 7 |
/* File: misc.h */ |
| 8 |
/* */ |
| 9 |
/* Purpose: header for misc.c */ |
| 10 |
/* */ |
| 11 |
/* Author: Henrik Rentz-Reichert */ |
| 12 |
/* Institut fuer Computeranwendungen */ |
| 13 |
/* Universitaet Stuttgart */ |
| 14 |
/* Pfaffenwaldring 27 */ |
| 15 |
/* 70569 Stuttgart */ |
| 16 |
/* internet: [email protected] */ |
| 17 |
/* */ |
| 18 |
/* History: 23.02.95 ug3-version */ |
| 19 |
/* */ |
| 20 |
/* Revision: 07.09.95 */ |
| 21 |
/* */ |
| 22 |
/****************************************************************************/ |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
/****************************************************************************/ |
| 27 |
/* */ |
| 28 |
/* auto include mechanism and other include files */ |
| 29 |
/* */ |
| 30 |
/****************************************************************************/ |
| 31 |
|
| 32 |
#ifndef __MISC__ |
| 33 |
#define __MISC__ |
| 34 |
|
| 35 |
|
| 36 |
#include "ugtypes.h" |
| 37 |
#include <cstring> |
| 38 |
#include "heaps.h" |
| 39 |
|
| 40 |
#include "namespace.h" |
| 41 |
|
| 42 |
START_UG_NAMESPACE |
| 43 |
|
| 44 |
/****************************************************************************/ |
| 45 |
/* */ |
| 46 |
/* defines in the following order */ |
| 47 |
/* */ |
| 48 |
/* compile time constants defining static data size (i.e. arrays) */ |
| 49 |
/* other constants */ |
| 50 |
/* macros */ |
| 51 |
/* */ |
| 52 |
/****************************************************************************/ |
| 53 |
|
| 54 |
/* cleanup old definitions of macros */ |
| 55 |
#define POW2(i) (1<<(i)) |
| 56 |
|
| 57 |
#define SET_FLAG(flag,bitpattern) (flag |= (bitpattern)) |
| 58 |
#define CLEAR_FLAG(flag,bitpattern) (flag &= ~(bitpattern)) |
| 59 |
#define READ_FLAG(flag,bitpattern) ((flag & (bitpattern))>0) |
| 60 |
|
| 61 |
#define HiWrd(aLong) (((aLong) >> 16) & 0xFFFF) |
| 62 |
#define LoWrd(aLong) ((aLong) & 0xFFFF) |
| 63 |
|
| 64 |
#define SetHiWrd(aLong,n) aLong = (((n)&0xFFFF)<<16)|((aLong)&0xFFFF) |
| 65 |
#define SetLoWrd(aLong,n) aLong = ((n)&0xFFFF)|((aLong)&0xFFFF0000) |
| 66 |
|
| 67 |
/* concatenation macros for preprocessor */ |
| 68 |
#define XCAT(a,b) a ## b |
| 69 |
#define XCAT3(a,b,c) a ## b ## c |
| 70 |
#define CAT(a,b) XCAT(a,b) |
| 71 |
#define CAT3(a,b,c) XCAT3(a,b,c) |
| 72 |
|
| 73 |
/* expand macro and transfer expanded to string */ |
| 74 |
#define XSTR(s) # s |
| 75 |
#define STR(s) XSTR(s) |
| 76 |
|
| 77 |
/****************************************************************************/ |
| 78 |
/* */ |
| 79 |
/* definition of exported global variables */ |
| 80 |
/* */ |
| 81 |
/****************************************************************************/ |
| 82 |
|
| 83 |
#ifndef ModelP |
| 84 |
|
| 85 |
END_UG_NAMESPACE |
| 86 |
namespace PPIF { |
| 87 |
|
| 88 |
extern int me; /* to have in the serial case this variable as a dummy */ |
| 89 |
extern int master; /* to have in the serial case this variable as a dummy */ |
| 90 |
extern int procs; /* to have in the serial case this variable as a dummy */ |
| 91 |
} /* end namespace PPIF */ |
| 92 |
START_UG_NAMESPACE |
| 93 |
|
| 94 |
extern int _proclist_; /* to have in the serial case this variable as a dummy*/ |
| 95 |
extern int _partition_; /* to have in the serial case this variable as a dummy*/ |
| 96 |
#endif |
| 97 |
|
| 98 |
/****************************************************************************/ |
| 99 |
/* */ |
| 100 |
/* function declarations */ |
| 101 |
/* */ |
| 102 |
/****************************************************************************/ |
| 103 |
|
| 104 |
/* general routines */ |
| 105 |
char *expandfmt (const char *fmt); |
| 106 |
const char *strntok (const char *str, const char *sep, int n, char *token); |
| 107 |
|
| 108 |
END_UG_NAMESPACE |
| 109 |
|
| 110 |
#endif |