summaryrefslogtreecommitdiff
path: root/reference/C/CONTRIB/SNIP/toolkit.h
blob: d7ba5a73c0036b2d1fd3b21eb82a99cb3f8ba5e9 (plain)
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
/*
**  This is a copyrighted work which is functionally identical to work
**  originally published in Micro Cornucopia magazine (issue #52, March-April,
**  1990) and is freely licensed by the author, Walter Bright, for any use.
*/

/*_ toolkit.h   Tue Apr 18 1989   Modified by: Walter Bright */

#ifndef TOOLKIT_H
#define TOOLKIT_H

/* Define stuff that's different between machines.
 * PROTOTYPING		1 if compiler supports prototyping
 * HOSTBYTESWAPPED	1 if on the host machine the bytes are
 *			swapped (1 for 6809, 68000, 0 for 8088
 *			and VAX).
 */

#ifdef MSDOS
#define PROTOTYPING	1
#define HOSTBYTESWAPPED	0

#define BITSPERBYTE 8
#define SIZEOFINT   sizeof(int)
#define SIZEOFLONG  sizeof(long)

#else
#ifdef M_UNIX     /* SCO UNIX using Microsoft C. */
#define PROTOTYPING	1
#define HOSTBYTESWAPPED	0
#define EXIT_SUCCESS	0
#define EXIT_FAILURE	1

#define BITSPERBYTE 8
#define SIZEOFINT   sizeof(int)
#define SIZEOFLONG  sizeof(long)
#else                   /* NOTE: host.h is *NOT* included in SNIPPETS    */
#include	"host.h"	/* Compiler/environment-specific stuff goes here */
#endif

#endif

/* Static definitions do not appear in the linker .MAP file. Override	*/
/* the definition here to make them global if necessary.		*/
#ifndef STATIC
#define STATIC	static
#endif

#define arraysize(array)	(sizeof(array) / sizeof(array[0]))

/* Macros so that we can do prototyping, but still work with non-	*/
/* prototyping compilers:						*/

#if PROTOTYPING
#define P(s)	s
#else
#define P(s)	()
#endif

#ifdef DEBUG
#define debug(a)	(a)
#else
#define debug(a)
#endif

#endif /* TOOLKIT_H */