1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)defs.h	5.1 (Berkeley) 5/31/85
   7:  */
   8: 
   9: /*
  10:  * Public definitions, common to all.
  11:  */
  12: 
  13: #include <stdio.h>
  14: 
  15: #define new(type)           ((type) malloc(sizeof(struct type)))
  16: #define newarr(type, n)     ((type *) malloc((unsigned) (n) * sizeof(type)))
  17: #define dispose(ptr)        { free((char *) ptr); ptr = 0; }
  18: 
  19: #define public
  20: #define private static
  21: 
  22: #define ord(enumcon) ((unsigned int) enumcon)
  23: #define nil 0
  24: #define and &&
  25: #define or ||
  26: #define not !
  27: #define div /
  28: #define mod %
  29: #define max(a, b)    ((a) > (b) ? (a) : (b))
  30: #define min(a, b)    ((a) < (b) ? (a) : (b))
  31: 
  32: #define assert(b) { \
  33:     if (not(b)) { \
  34:     panic("assertion failed at line %d in file %s", __LINE__, __FILE__); \
  35:     } \
  36: }
  37: 
  38: #define badcaseval(v) { \
  39:     panic("unexpected value %d at line %d in file %s", v, __LINE__, __FILE__); \
  40: }
  41: 
  42: #define checkref(p) { \
  43:     if (p == nil) { \
  44:     panic("reference through nil pointer at line %d in file %s", \
  45:         __LINE__, __FILE__); \
  46:     } \
  47: }
  48: 
  49: typedef int Integer;
  50: typedef int integer;
  51: typedef char Char;
  52: typedef double Real;
  53: typedef double real;
  54: typedef enum { false, true } Boolean;
  55: typedef Boolean boolean;
  56: typedef char *String;
  57: 
  58: #define strdup(s)       strcpy(malloc((unsigned) strlen(s) + 1), s)
  59: #define streq(s1, s2)   (strcmp(s1, s2) == 0)
  60: 
  61: typedef FILE *File;
  62: typedef int Fileid;
  63: typedef String Filename;
  64: 
  65: #define get(f, var) fread((char *) &(var), sizeof(var), 1, f)
  66: #define put(f, var) fwrite((char *) &(var), sizeof(var), 1, f)
  67: 
  68: #undef FILE
  69: 
  70: extern long atol();
  71: extern double atof();
  72: extern char *malloc();
  73: extern String strcpy(), index(), rindex();
  74: extern int strlen();
  75: 
  76: extern String cmdname;
  77: extern String errfilename;
  78: extern short errlineno;
  79: extern int debug_flag[];

Defined typedef's

Fileid defined in line 62; used 6 times
Filename defined in line 63; used 4 times
Real defined in line 52; never used
String defined in line 56; used 161 times
real defined in line 53; never used

Defined macros

and defined in line 24; used 288 times
badcaseval defined in line 38; used 2 times
get defined in line 65; used 3 times
max defined in line 29; never used
min defined in line 30; never used
nil defined in line 23; used 597 times
or defined in line 25; used 180 times
private defined in line 20; used 313 times
public defined in line 19; used 363 times
put defined in line 66; never used

Usage of this include

Last modified: 1985-05-31
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1598
Valid CSS Valid XHTML 1.0 Strict