|
#define | PI (4.0 * atan(1.0)) |
|
#define | TRUE 1 |
|
#define | FALSE 0 |
|
#define | RANGECHECK(x, y, z) ((x)<(y)) ? (y) : ((x)>(z)) ? (z) : (x) |
|
#define | DISTSQ(a, b) |
|
#define | DIST(a, b) |
|
#define | ABS(x) (((x)<0) ? (-(x)) : (x)) |
|
#define | MAX(a, b) (((a)>(b)) ? (a) : (b)) |
|
#define | MIN(a, b) (((a)<(b)) ? (a) : (b)) |
|
#define | INIT(x, y) |
|
#define | INITPREV(x, y) |
|
#define | NEXT(x) (x)=(x)->next |
|
#define | PREV(x) (x)=(x)->prev |
|
#define | ALLOCNEXT(x, y) |
|
#define | ALLOCNEXTPREV(x, y) |
|
#define | LAST(x) while(((x)!=NULL) && ((x)->next != NULL)) NEXT(x) |
|
#define | FREELIST(y, z) |
|
#define | FREE(x) if((x)!=NULL) free(x); (x) = NULL |
|
#define | DELETE(x, y, z) |
|
#define | DELETEDOUBLE(s, x, y) |
|
#define | FINDPREV(p, s, l) |
|
#define | NEWLINE printf("\n") |
|
#define | TOGGLE(x) (x) = (x) ? FALSE : TRUE |
|
#define | TERMINATE(x) |
|
#define | TERMINATECR(x) |
|
#define | TERMAT(x, y) |
|
#define | UPPER(x) |
|
#define | LOWER(x) |
|
#define | KILLLEADSPACES(y, x) |
|
#define | KILLTRAILSPACES(x) |
|
#define | TESTINARRAY(x, l, y, r) |
|
#define | FINDINARRAY(x, l, y, r) |
|
#define | PADMINTERM(string, len) |
|
#define | PADCHARMINTERM(s, c, l) |
|
#define | DOTIFY(str) |
|
#define | DEDOTIFY(str) |
|
#define | SUBSCHAR(s, x, y) |
|
#define | STRNCPYNOSPACES(out, in, mx) |
|
#define | SET(x, y) (x) |= (y) |
|
#define | UNSET(x, y) (x) &= (~(y)) |
|
#define | ISSET(x, y) ((BOOL)((x)&(y))) |
|
#define | FCLOSE(x) |
|
#define | D(BUG) |
|
#define | PROMPT(in, x) printf("%s",(x)) |
|
Useful macros.
- Version
- V2.26
- Date
- 14.12.16
- Copyright
- (c) Dr. Andrew C.R. Martin / UCL 1991-2016
- Author
- Dr. Andrew C. R. Martin
- Institute of Structural & Molecular Biology, University College London, Gower Street, London. WC1E 6BT.
- andre.nosp@m.w@bi.nosp@m.oinf..nosp@m.org..nosp@m.uk andre.nosp@m.w.ma.nosp@m.rtin@.nosp@m.ucl..nosp@m.ac.uk
This code is NOT IN THE PUBLIC DOMAIN, but it may be copied according to the conditions laid out in the accompanying file COPYING.DOC.
The code may be modified as required, but any modifications must be documented so that the person responsible can be identified.
The code may not be sold commercially or included as part of a commercial product except as described in the file COPYING.DOC.
Description:
If not Amiga defines abs(). Defines max(), min() and PI if not done. Defines list handling macros. Defines newline() and toggle() macros.
Usage:
Revision History:
- V1.0 06.02.91 Original
- V1.1 15.02.91 Moved PI definition to non-Amiga's only
- V1.2 21.03.91 Added RANGECHECK
- V1.3 06.09.91 Added DIST, DISTSQ and Vec3f
- V1.4 09.09.91 Fixed multi-command macros with {}
- V1.5 24.01.92 Fixed for 32 bit addresses and added malloc checks.
- V1.6 03.04.92 Small change to ALLOCNEXT and ALLOCNEXTPREV, so will do a NEXT() even if malloc() fails.
- V1.7 06.05.92 Added TERMINATE()
- V1.8 06.07.92 Added MAX(), MIN() and ABS()
- V1.9 22.07.92 Fixed ABS()
- V1.10 28.09.92 Added TRUE & FALSE and UPPER()
- V1.11 03.11.92 Changed TOGGLE and newline is now upper case.
- V1.12 16.11.92 Added KILLLEADSPACES()
- V1.13 18.11.92 Fixed UPPER() for MicrosoftC which returns strlen() as unsigned
- V1.14 20.11.92 ABS() now uses 0 rather than 0.0, so we don't try to use floats with ints...
- V2.0 24.11.92 Removed all small letter macros
- V2.1 12.07.93 Added double include check, moved math definitions to MathType.h and added LOWER()
- V2.2 07.10.93 UPPER() and LOWER() check case first for ESV compatibility
- V2.3 23.05.94 Added D(BUG)
- V2.4 14.07.94 Added do{}while(0) bracketing of all multi-line macros
- V2.5 21.11.94 ABS, MAX and MIN check that they're not already defined
- V2.6 16.02.95 Added DELETE()
- V2.7 21.02.95 Updated some internal variable names
- V2.8 02.08.95 Added TESTINARRAY(), FINDINARRAY(), SET(), UNSET() and ISSET()
- V2.9 20.11.95 Added TERMAT()
- V2.10 06.02.96 Added KILLTRAILSPACES()
- V2.11 14.06.96 Added PROMPT()
- V2.12 23.07.96 Added PADMINTERM()
- V2.13 19.09.96 Include ctype for UPPER() etc
- V2.14 13.03.99 Added DELETEDOUBLE()
- V2.15 01.03.01 Added DOTIFY() DEDOTIFY() PADCHARMINTERM() SUBSCHAR()
- V2.16 25.01.06 Added FINDPREV()
- V2.17 10.04.08 Fixed bug in DELETE() - the break was not properly stopping prev from being changed
- V2.18 29.04.14 Added DEPRECATED() By: CTP
- V2.19 07.05.14 Moved DEPRECATED() to deprecated.h By: CTP
- V2.20 07.07.14 Use bl prefix for functions - change padterm() to blPadterm() By: CTP
- V2.21 24.07.14 Initialize list pointers for DELETE macro. By: CTP
- V2.22 25.02.15 LAST() is now safe if the pointer is NULL
- V2.23 26.06.15 Added STRNCPYNOSPACES(out, in, mx)
- V2.24 28.08.15 Added FREE()
- V2.25 04.11.15 Added FCLOSE()
- V2.26 14.12.16 Added TERMINATECR()
Definition in file macros.h.