1: /*
2: numeric() is useful in while's, if's, etc., but don't use *p++
3: max() and min() depend on the types of the operands
4: abs() is absolute value
5: */
6: # define numeric(c) (c >= '0' && c <= '9')
7: # define max(a,b) (a<b ? b : a)
8: # define min(a,b) (a>b ? b : a)
9: # define abs(x) (x>=0 ? x : -x)
10:
11: # define copy(srce,dest) cat(dest,srce,0)
12: # define compare(str1,str2) strcmp(str1,str2)
13: # define equal(str1,str2) !strcmp(str1,str2)
14: # define length(str) strlen(str)
15: # define size(str) (strlen(str) + 1)
16:
17: /*
18: The global variable Statbuf is available for use as a stat(II)
19: structure. Note that "stat.h" is included here and should
20: not be included elsewhere.
21: Exists(file) returns 0 if the file does not exist;
22: the flags word if it does (the flags word is always non-zero).
23: */
24: # include <sys/types.h>
25: # include <sys/stat.h>
26: struct stat Statbuf;
27: # define exists(file) (stat(file,&Statbuf) < 0 ? 0 : Statbuf.st_mode)
28:
29: /*
30: libS.a interface for xopen() and xcreat()
31: */
32: # define xfopen(file,mode) fdfopen(xopen(file,mode),mode)
33: # define xfcreat(file,mode) fdfopen(xcreat(file,mode),1)
34:
35: # define remove(file) xunlink(file)
36:
37: /*
38: SAVE() and RSTR() use local data in nested blocks.
39: Make sure that they nest cleanly.
40: */
41: # define SAVE(name,place) { int place name;
42: # define RSTR(name,place) name = place;}
43:
44: /*
45: Use: DEBUG(sum,d) which becomes fprintf(stderr,"sum = %d\n",sum)
46: */
47: # define DEBUG(variable,type) fprintf(stderr,"variable = %type\n",variable)
48:
49: /*
50: Use: SCCSID(%W%) which becomes static char Sccsid "%W%"
51: */
52: # define SCCSID(arg) static char Sccsid[] "arg"
53:
54: /*
55: Use of ERRABORT() will cause libS.a internal
56: errors to cause aborts
57: */
58: # define ERRABORT() _error() { abort(); }
59:
60: /*
61: Use of USXALLOC() is required to force all calls to alloc()
62: (e.g., from libS.a) to call xalloc().
63: */
64: # define USXALLOC() alloc(n) {return(xalloc(n));} free(n) {xfree(n);} \
65: malloc(n) {register p; p=xalloc(n); return(p != -1?p:0);}
66:
67: # define NONBLANK(p) while (*p==' ' || *p=='\t') p++
68:
69:
70: /*
71: A global null string.
72: */
73: char Null[1];
74:
75: /*
76: A global error message string.
77: */
78: char Error[128];
Defined variables
Error
defined in line
78;
never used
Null
defined in line
73;
never used
Defined macros
DEBUG
defined in line
47;
never used
RSTR
defined in line
42;
never used
SAVE
defined in line
41;
never used
abs
defined in line
9;
never used
copy
defined in line
11;
never used
equal
defined in line
13;
never used
max
defined in line
7;
never used
min
defined in line
8;
never used
size
defined in line
15;
never used