1 /*************************************************************************/
3 /* Copyright (c) 1994 Stanford University */
5 /* All rights reserved. */
7 /* Permission is given to use, copy, and modify this software for any */
8 /* non-commercial purpose as long as this copyright notice is not */
9 /* removed. All other uses, including redistribution in whole or in */
10 /* part, are forbidden without prior written permission. */
12 /* This software is provided with absolutely no warranty and no */
15 /*************************************************************************/
18 * STDINC.H: standard include file for C programs.
25 * If not already loaded, include stdio.h.
31 * STREAM: a replacement for FILE *.
37 * NULL: denotes a pointer to no object.
45 * BOOL, TRUE and FALSE: standard names for logical values.
58 * BYTE: a short name for a handy chunk of bits.
61 typedef unsigned char byte;
64 * STRING: for null-terminated strings which are not taken apart.
70 * REAL: default type is double;
73 typedef double real, *realptr;
76 * PROC, IPROC, RPROC: pointers to procedures, integer functions, and
77 * real-valued functions, respectively.
80 typedef void (*proced)();
81 typedef int (*iproc)();
82 typedef real (*rproc)();
85 * LOCAL: declare something to be local to a file.
86 * PERMANENT: declare something to be permanent data within a function.
90 #define permanent static
93 * STREQ: handy string-equality macro.
96 #define streq(x,y) (strcmp((x), (y)) == 0)
99 * PI, etc. -- mathematical constants
102 #define PI 3.14159265358979323846
103 #define TWO_PI 6.28318530717958647693
104 #define FOUR_PI 12.56637061435917295385
105 #define HALF_PI 1.57079632679489661923
106 #define FRTHRD_PI 4.18879020478639098462
109 * ABS: returns the absolute value of its argument
110 * MAX: returns the argument with the highest value
111 * MIN: returns the argument with the lowest value
114 #define ABS(x) (((x) < 0) ? -(x) : (x))